I have a rigidbody2d with a hingejoint2d connected to it and nothing else, so as to “pin” the rigidbody and have it rotate around a fixed point.
This works ok, unless there are other rigidbodies resting on the hinged one. In that case, the hinge connected anchor is slowly drifting away from the anchor, and cannot seem to hold the weight of the rigidbodies resting on it.
Is there a way to prevent the anchors from separating and making a firmly pinned rigidbody rotate around the hinge?
All the rigidbodies have a mass of 100, Gravity Scale is 50 and gravity is 20.
Thanks!
Eventually solved by setting the mass of the carrying object to a high value (I used 1000), and the resting objects to a low value (used 1).
The hinge is now firmly holding the carrying object and all the objects resting upon without visibly moving (there is a slight movement apparent in the object’s transform).
If both the carrier and the objects being held have the same mass, whatever the value, the issue recurs.
I had a similar problem with two Rigidbody2Ds connected by hinge joint where if the transform.position of the connected Rigidbody2D was changed via script, the connected anchor would drift during run-time. I fixed this by turning off auto set for connected anchor point in the inspector of the Hinge joint. This must be a bug because I would think the anchor points should not change on their own.
Go into Project setting → Physics2D and set Default Connect Offset to the lowest it can go. This fixed it for me.
You need to activate the “IsKinematic” value in the carrying RigidBody.