I’m working on a 2D project, and we’re trying to make plants that react when the player walks past. I’ve used hinge joints at the base of each plant, but the limits I have set (10° and -10° respectively) are ignored and the plants just continue to rotate, until they are laying flat against the ground.
I’m using Spring: spring 10; dampener 0; target angle 0
and Limits: min -10; max 10; min bounce 0; max bounce 0
break and torque are infinite.
Any insights would be much appreciated!
How are you rotating the plants? Are you letting the Physics engine control the rotation somehow? If you manually adjust the rotation, the hinge joint won’t work. However, if you’re manually adjusting the rotation, why not just limit it right there. Sorry to answer this, comments are broken right now in Unity Answers.
I’ve Solved it! Though I’m not sure if this is a hack or the intended method.
-Two game objects per plant: The Plant, and a rigidbody
-Rigidbody is moved to the anchor point for the plant, and connected to hinge joint
-Make sure box collider has depth.
The box collider I had attached to my plants was set to 0 on z. Screwed the whole thing up! I set it to 0.1, and viola. Limits are working, but only while connected to the second game object.