Doors and Hinge Joints

Please see the GIF image. Why does this HingeJoint behaves like this? It has a -90,90 limit. And uses Spring.

I want it to stop and the -90,90 angles even if I push it.

Any idea what could be the cause?

GIF: Imgur: The magic of the Internet

Image of Joint Settings:

Without seeing your code, I’m going to assume it has something to do with your door/gate’s parent object.
As your gate is a child of the pillar, then your bounds are going to be relative to the pillar (the parent object), and not worldspace.

On the second picture, under “Motor” you’ve checked “use limits” but right above that you do not have “Use Motor” checked. I don’t know how the code is written, but I would assume that the limits on the motor don’t apply unless you’re actually using the motor.

Also, I know it should be obvious, but check to make sure that you’re putting your bounds on the correct axis, and set them to 89.5 degrees instead of true 90. A player won’t notice the difference and it’ll stop any clipping issues you might run into as well. I mention this because your joint settings in the editor do not specify which axis is being “locked”.

You should also check your “lock” on the translation, as that could be another possible source of problems.

If it were me, what I would do is remove the collider from the door itself. I would put a proximity collider around the door with a listener. When your player’s collider enters the door collider, I would have it trigger a “door opens” animation.