Search code examples
unity-game-enginecollisiongame-physics

Unity3D colliders act more like sponges than solid objects


I am making a platformer in Unity3D and I've noticed Unity3D's colliders are behaving weirdly in the simple sense that they don't seem to be solid.

To better demonstrate the problem I have used a simple sphere and cube and paused the game as the sphere "jumps" Flipping through frames frame by frame you can clearly see the ball dip below the cube.

Jump height

Just before hitting cube

Part of the sphere disappearing through the cube

How the ball lands

Why is this happening and how can I fix it?


Solution

  • The rigidbody has a set of option for collision detection. Different option provide different results but this is occuring because the detection is not checked frequently enough. You can switch to another option to improve this at a cost of performance. Here are a list of the options available and when they are best used.

    1. Discrete - unless you experience problems you should use discrete. 
    2. Continuous - for fast moving objects that are interacting with static geometry.
    3. Continuous Dynamic -as above but are also interacting with other fast moving dynamic objects.
    

    Hope that helps.