Making joint aim in the same direction as the main camera, regardless of joint axis
Hello
I'm trying to make a ConfigurableJoint aim in the same direction the camera is aiming in regardless of it's axis or rotation.
My setup is a main rigidbody with a joint connecting it and another rigidbody.
The joint can be configured in any number of ways, i.e It can be acting as a hinge, or it can be acting as a wheel type joint, depending on what the axis is configured as.
I want to make it so that the joint, no matter how it's configured or how the "main body" is rotated, always tries to match it's forward rotation to the camera's forward rotation.
I've tried some simple math code like joint.TargetRotation = Quaternion.LookRotation(Camera.main.transform.forward,joint.axis)
but it's not giving me the result I want, and I assume it's not going to be as simple as that :P
Any ideas on how best to approach this? I'm not a math expert so I feel like that's what i'm missing.
Thanks in advance!