- Home /
Prevent collider intersection
Hi, I'm just having an issue with colliders at a very small size which are intersecting each other at no velocity.
I set up a few cubes with scale 0.1 and froze the position on Z - rotation on XY (like there is no third dimension). My gravity is set to -0.81 so there is not much pressure on the cubes.
When testing the scene all colliders of the cubes will intersect (image attached).
Is there a way to prevent this behavior? I would need them to collide very clean, but sizing them up also affects other physical properties so thats not what I want.
I set it from 0.01 to 0.001 and it looks much better now, thanks! Do you know something about how this affects performance?
Would you turn your comment into an answer so I can mark it?
Answer by Matthew A · Feb 14, 2013 at 10:03 AM
I guess it's because of the min penetration setting: http://docs.unity3d.com/Documentation/ScriptReference/Physics-minPenetrationForPenalty.html
I'm afraid I don't know how this affects performance though.
Answer by MadDave · Feb 14, 2013 at 10:48 AM
Physics engines need to allow some small penetrations, otherwise the system would never come to rest (i.e. stop moving).
You can tweak some parameters of the physics system and see if that helps (Edit - Project Settings - Physics). Try reducing the Minimum Penetration for Penalty Force or increasing the iteration count.
However, it is generally difficult to get a "crisp" result from a physics engine. That's just not how physics engines work.
Yes still fighting with other properties like scale, time scale, mass and so on. Thanks for your hint that a too small penetration will prevent the bodies from sleeping.