- Home /
Make a hinge joint stay firmly in place
I have a 'trapdoor' prefab with a single hinge joint (2D game). The hinge joint is attached to one side of my trapdoor and then connected to the 'world'. When the door opens, it rotates around the hinge as expected.
But when some force is applied to the trapdoor, the hinge 'gives' a bit, like the connection to the world is a bit elastic (e.g. I drop a ball onto a closed trapdoor and the trapdoor, including the hinge, will bounce down a bit and then snap back into place. How can I stop this? I want my hinge to only rotate, never to move.
This is 2D physics in Unity 4.5.
The trapdoor pivots around that hinge joint (in this example the plank would turn downwards and touch that star). However, if a physics object falls onto the top of the plank, the plank (and hinge!) moves down a small amount before bouncing back into place. The movement increases if more force is applied. The hinge acts like a spring almost. If I zoom in I can see that the hinge is at a single point, not a small distance away from the actual connection to the plank's rigidbody (which is what it seems like from the behaviour).
Did you found a way to fix this eventually? Stumbled with same issue here :(
Answer by Hah_BiKes · Jun 22, 2016 at 04:00 PM
Just increase the mass of the door ( or if you are using automass then increase the density to something like 50 )
Answer by James-Covalent-Bond · Mar 24, 2018 at 08:00 PM
My problem was that I had "Auto Configure Connected Anchor" enabled
Answer by Ben-Stoneman · Jun 11, 2014 at 04:07 PM
As I cannot see what your trap door does and I have no idea what your trap door is supposed to do I guess I can only really help by telling you a way to avoid the bounce back.
I hope I'm correct in thinking that your trap door bounces off the world when it collides with it. You can avoid this with the "Angle Limits" setting in the inspector.
Below is the trap door with a 90 degree "Angle Limit" applied.
This stops the trap door from not only hitting the platform it is connected to, but also from bouncing back.
Please Accept this if it has answered your question. And let me know if it does not :)
Thanks for responding. That isn't the issue I'm having, however. I will add an image to my question when I get to my dev PC to illustrate better.
$$anonymous$$y problem is that the hinge joint itself moves. I want the joint to stay where I placed it in the designer...regardless of any force acting on it or on the attached plank (which makes up the trapdoor).
I'm Unable to recreate the issue with the movement of the anchor or the connected anchor. $$anonymous$$ine stay perfectly still.
Can you provide a small example project?
Thanks for helping, Ben. I've added a simple repro project to my question.
When the ball lands on the trapdoor in my repro, the trapdoor should be absolutely still, but bobs down slightly. The repro doesn't include the code to open the trapdoor, so in the example the trapdoor is not supposed to open, but rather to act like a stationary shelf. You can see the hinge joint stretch (try adding more mass to the ball to exaggerate the effect).
Answer by taxvi · Feb 03, 2015 at 11:10 AM
8 moths too late but anyone looking for an answer look at this thread:
http://answers.unity3d.com/questions/34879/rubbery-hinge-joints.html
Your answer
Follow this Question
Related Questions
2D Joint/Wheel Question 1 Answer
Character Joints, twist and swing 0 Answers
Why are my hinge joints inaccurate? 1 Answer