Hi,
I wanted to create a box that a user can open using his VR controllers. I added a HingeJoint, connected it to the top lid rigidbody of the box. Then I wanted to add a FixedJoint to the VR Controller, and connect it to the top lid rigidbody of the box.
This works fine for a limited range of motion. When the HingeJoint gets close to 90 degrees, it goes completely off the rails.
What is the reason for that?
And how can I solve this?
Aaargh! Now I’ve written a script that handles the rotation. I set the connectedBody of the HingeJoint to null, then I rotate the Lid transform. Then I assign the connectedBody back to Lid.
But now this bug ruins it:
Now, since the HingeJoint.angle property does not change, my min and max limits are relative to the rotation of Lid transform. Meaning, if my min is -120, and max is +60, if I rotate the Lid by 30, the new “actual” min will be -90 and the new “actual” max will be +90. This is so messed up.
Okay, I hacked it by re-adjusting the limits after I rotated the lid. But that can’t be the final solution. Unity needs to fix that bug.
The problem might be due to the fixed joint trying to keep not only the distance between the lid and the controller constant but also trying to keep the angle constant. The hinge between the box and lid is trying to keep the objects together at the hinge, while the controller is trying to rotate the lid in a different direction to maintain its own angle. If this is the case, it’s likely that your controller is a kinematic body, so that it wont rotate unless explicitly told to. Either try to use a different joint that does not try to maintain angle (eg. a stiff spring joint with a fixed distance) or change the controller to a dynamic rigidbody (instead of a kinematic one) if possible.
Did you find a solution to this? I have a similar Problem. A simple Robot arm with two hinge / or character joints to move by angle without flickering or exploding…