I am struggling with configurable joint for a week now.
I need to calibrate a configurable joint in az “editor-like” scene. Save the values and then use them when connecting rigidbodies with configurable joints instantiate using code.
Can someone explain to me how does TargetRotation work?
I searched the net for some kind of documentation but I found nothing.
Unity’s documentation is hilariously short.
Nvidia’s almost non-existent.
Can someone explain me how the target rotation is working?
Please point me to any documentation which I may have missed out.
So I think I got it figured out.
TargetRotation is applied when the two rigidbodies are connected and it is relative to the initial rotation of the Rigidbody.
Also you must translate your desired rotation in the local coordinate system of the joint represented by the Main and Secondary Axis.
NOTE: every time the Configurable Joint’s connected rigidbody is changed it is recalculated so a fast changing of this property will result in a circular motion.
Hope this will help someone in the future beause I shore lost a lot of time messing around with it.
I found while using scrips, C#, The Rigidbody falls asleep. You need to wake it up within the script during each update. It is a bad idea to mess with a Quaternion directly. You should set XYZ in Euler angles with a vector3.
public Vector3 Vec1; Then you set your Quaternion with it, this way: private Quaternion QVec1; QVec1 = Quaternion.Euler (Vec1); QVec1 would be your set Quaternion with the angles you wish it to have. This is my vid on the subject you ask about, if you wish to check it out. Link: ConfigurableJointScript 1
The vid tells how to properly set TargetRotation within a script, and have it work!
Hope this helps.