- Home /
How to enforce HingeJoint2D angle limits?
Hello, I'm trying to use HingeJoint2D to make a somewhat ragdoll-like structure prop itself up, and also be able to wiggle its limbs. I have also set it so that none of the rigidbodies involved in a structure like this can collide with each other.
It should be noted that I have overlapping colliders, but I believe this shouldn't matter as all colliders are on a layer that cannot collide with itself.
I have set Use Limits to true, and I have set an upper and lower angular limit.
Now, I have made 3 assumptions, and it seems the angle indicators all agree with me:
The angles are in degrees
0 degrees is the right-hand side of the x-axis, and it goes around anti-clockwise
The angles are in local space
Now, I'm having the following issues:
The hinges seem to be able to twist outside of the specified angle limits (even though they are enabled and set)
The hinges seem to twist and apply their own force (even with motor speed of 0, gravity scale on all rigidbodies set to 0
Here are some screenshots for context. The red arrow points towards a hinge in the first screenshot, the same hinge in the second screen shot, and its details are then shown in the third screen shot. http://imgur.com/a/gZnsL
Screenshot 1: The structure in its default pose, with angle restriction markers shown
Screenshot 2: The structure in its "settled" pose after it rotates in 0 gravity
Screenshot 3: Settings for one of the hinges
How do I go about ensuring that the angle of the HingeJoint2D must always stay within the limits? In reference to the first screenshot, I would like to keep the rotations within the angle indicators (not necessarily needing elasticity, just rigidly keeping rotation within the limits would even be preferable).
My apologies for the long post.
Your answer
![](https://koobas.hobune.stream/wayback/20220612132314im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to access the variables of HingeJoint2d? 1 Answer
HingeJoint2D disabling and re enabling limits, makes the joint rotate all the way back 0 Answers
Hingejoint2D makes a spin before getting into the angle limits. 1 Answer
Connected Rigidbody2D with HingeJoint2D not working properly 0 Answers
Hinge Joint 2D with seperate push movement through physics 0 Answers