I have a simple object with a Rigidbody that has it’s Y position frozen. I don’t want any movement on the Y axis whatsoever.
The freeze works fine when there are no physics interactions… However, when the object collides with another physics object, it’s Y position begins changing (very slightly, only tenths of a unit per second). If it’s not frozen, the Y position changes much more rapidly, so the freeze is doing something, just not enough. I can’t figure out why this is occuring.
I have no scripted collision interactions at the moment, so it’s only the physics system acting on it.
Do I need to manually set the Y position to 0 constantly in a script? That feels… odd to me, especially since the constraints are there for this specific purpose.
I think I figured it out. I’m using a sphere collider, but I had the center of the collider slightly off at 0,-.5,0 (you can change the collider’s center in the component menu) . I changed it to 0,0,0 and problem solved. Freezing position takes place in local space, not world space, so I believe it has to do with a skewed rotation or collision force based on the collider center, that causes the Rigidbody to interpret it’s local space in a weird way.
Hope that helps.
I had a same issue when freeze position and rotation not worked as they supposed to. I had two (box) colliders on my object, but one of them was under Rigidbody component. When moved collider up everything started to behave normally. Don’t think that it will solve every issue, but it worked for me.