- Home /
Sphere with collider entering the flat surface
Hello, everyone.
I'm developing a pinball game, as some here already know and helped me in other situations. To finish the game, I have to fix a bug that is occurring with the marbles.
I have a ball with a sphere collider and a rigidbody on the table, which is a plan with a rigidbody and a mesh collider.
What happens is that if I keep the radius of the sphere collider exactly the radius of the ball, she gets a little inside the table, is not exactly on it. The same occurs with other objects, such as flippers, the ball gets a little inside of the flippers. Is there any way to fix this without increasing the radius of the ball?
I need to put the ball exactly over the table, not a little inside it.
Thanks!
Answer by PrimeDerektive · Jan 07, 2011 at 04:18 PM
Why not just tweak the collider radius value until you see the results you want? No one said they have to be the same.
Answer by Statement · Jan 07, 2011 at 05:26 PM
This is because there is a penetration threshold in the physics manager, called Min Penetration For Penalty.
How deep in meters are two objects allowed to penetrate before the collision solver pushes them apart. A higher value will make objects penetrate more but reduces jitter.
Setting this to zero should in theory remove the overlap but will probably result in jittering behavior. I suggest you either expand the sphere colliders radius or contract the graphics to allow some gap between the perimeters. If you look closely in many games involving physics you'll notice that things aren't as perfect as you think. Maybe you're too picky (because most people are likely not to notice) or you should try and tweak it to more perfection. You can try adjusting the size as Derek says but you can also try adjusting the penetration threshold.
Your answer
Follow this Question
Related Questions
Mesh collider trigger 2 Answers
collision between a rigidbody and a mesh collider not working 1 Answer
How to make a sphere fall from a cube when more than 50% of the sphere is outside the cube 2 Answers
Animating a box collider does not animate the mesh renderer. 1 Answer
How to rotate a mesh collider? 0 Answers