Question by
TimChadz · Mar 18, 2018 at 02:43 PM ·
physicshingejoint
Freeze a hinge joint whilst moving
I have a hinge joint connecting two objects. I want to 'lock' the hinge joint, move the two objects within the scene and then 'unlock' the hinge joint. As such, I can move the object without physics taking effect on the hinges.
However, upon 'unlocking' the hinge joint, it will move on occasion.
I.e. even if I do the following (have abbreviated the code to illustrate)
// For both rigidbodies linked by the hinge joint:
rigidbody.freezeRotation = true;
rigidbody.velocity = Vector3.zero;
rigidbody.isKinematic = true;
yield return new WaitForSeconds(1);
transform.RotateAround(.....);
yield return new WaitForSeconds(1);
// For both rigidbodies linked by the hinge joint:
rigidbody.freezeRotation = false;
rigidbody.velocity = Vector3.zero;
rigidbody.isKinematic = false;
I've also tried setting the gameobjects to active/inactive
I'm, trying to avoid using Physics.autoSimulation = true/false; as I'd like to use collision detection.
Any ideas?
Comment
Your answer
Follow this Question
Related Questions
How does hinge joint work? 0 Answers
Door hinge joints 0 Answers
Get object to rotate freely influenced by gravity 0 Answers
Local Hinge Joint Angle? 1 Answer