- Home /
Freeze rigidbody position without affecting rotation - please help!
I have 2 spheres on a flattened cube. All 3 items have rigidbodys and colliders.
For some reason, when gravity is used, the spheres slowly sink in to the cube. They stop about a sixth of the way in (ie 5/6ths of the sphere is above the surface).
To stop that, I unchecked 'Use gravity'. Unfortunately, when one sphere knocks in to another, it sends it flying off in mid air. So then I locked the positions of the spheres on the y axis by checking Freeze position under Constraints.
This is perfect apart from the fact it stops the spheres from rolling properly - they only seem to spin on the y axis (funnily enough). I haven't got any 'Freeze rotation' boxes checked and they roll fine when I don't freeze the position (just the aforementioned problems).
I'm really stuck on this one and have tried searching before posting. If anyone could help me make sure the rigidbody spheres keep their Y positions without affecting their rotation, please do! :-)
You may need to back up a few steps... Did you place the spheres above the flattened cube? If you did not that is your original problem. Unfreeze rotation, check "Use gravity," and try this. objects tend to fall through other objects when the first object has gravity and is touching the second object.
Sorry, I should have said - the spheres are definitely completely above the cube. I made them fall through the air and land on the cube to check it wasn't that :-)
Thank you muchly for your comment, it inspired me to again try and solve the original problem! :-)
Answer by joemcd88 · May 28, 2012 at 06:01 PM
After several hours of trying to figure it out, it took me less than 10 minutes to fix it once I had asked the question (always the way!).
To stop the spheres sinking in to the cube, I took the following steps:
1) Edit > Project Settings > Physics
2) Changed "Min Penetration for Penalty" to a lower value.
This stopped the spheres from going through the cube and should stop any similar problems anyone else might have in the future :-)
This might not be necessary unless you are working with really small game objects as the bigger the object, the less noticeable it is.