Anchor Offset Issue of Hinge Joint

9567775--1353712--upload_2024-1-8_7-50-56.png

As shown in the figure above, this is in the editor, I connect the handle to the bucket with Hinge Joint.

9567775--1353715--upload_2024-1-8_7-54-14.png

As shown in the figure above, when I run the game, the handle will drop down due to gravity, at this time, my project needs to set the bucket and handle to false due to some special requirement, that is to call SetActive(false), and when I set it to true again, the handle’s anchor changes to the position as shown in the figure below, and the handle’s position becomes not what is expected, and I don’t have any other script to change the anchor, how can I solve the problem?

9567775--1353718--upload_2024-1-8_7-54-36.png

My HingeJoint parameters are as follows, I’ve tried setting Auto Configure Connected Anchor to false but it doesn’t work.

Joints will reset their axis/angle when enabled. So what’s happening is that upon reactivating the hinge, its new limits are offsetted by the handle’s new orientation.

The solution is simple: reset the handle to its original orientation prior to re-activating the joint.

For more info: Hinge Joint limits resets on activate object