- Home /
Unstable Rigidbody with freeze position
Hi!
I create a tower using several boxes (rigidbody + box collider). When I select Rigidbody->Freeze position (x or z) then the tower becomes unstable. Boxes start to slide very slowly and whole tower collapses. When I use no constraints on rigidbody then the tower is stable. I've tried everything in physics settings, collision detection, interpolate, etc. Nothing so far. Here is a sample project to illustrate my problem: https://www.dropbox.com/s/esiy3mp51tr1248/unity%20physics%20test.zip?dl=0 I'm using Unity 2018.2.11f1
Answer by mightyIgrek · Oct 18, 2018 at 09:14 AM
No answers so far :( There is also a similar question, asked in 2016, still not answered, so I think it might be a bigger issue that no one knows how to fix.
For now I ditched position constraints. Instead I created small script that works like a spring joint in one axis:
void FixedUpdate()
{
float force = 1000;
float damping = 10;
rigidbody.AddForce(new Vector3(0, 0, (originalPosition.z - transform.position.z) * force - rigidbody.velocity.z * damping));
}
So far it works for me. Stacked boxes are stable and they are sort of locked in one axis.
Your answer
Follow this Question
Related Questions
How do I query the RigidbodyConstraints? 3 Answers
Stacking Rigidbody causes weird phsyics. Why? 0 Answers
Attempt to disable constraints using RigidbodyConstraints.None has no effect 0 Answers
Rigidbody: Freeze All vs InKinematic 0 Answers
Can you unfreeze a rigidbody.constraint position as you can freeze them? 2 Answers