Collision detection accuracy issues.


I am currently developing a 2.5D horizontal scroll platformer in StrangeLight Games. We have been using Unity for a while now and we have experienced some issues regarding trigger and collider detection not being as accurate as we needed. Until now these were not really important but we’ve come to a tougher situation recently.

In the caption below you can see in high poly, bumpmapped, with realtime shadows (just kidding, used some primitives :P) our configuration. Our character is the capsule object and the cube our enemy. When our player touches the enemy from above, the enemy dies, deactivating all of its colliders. We deactivate them in order to avoid the player from colliding with the bottom collider, which kills him.


Well, theory is simple but, In most cases our player dies and kills the enemy. That means there are few frames when our box enemy is dead, and alive at the same time, very Schrödinger cat’s like. The player should have deactivated its colliders but this takes some time, so our player manages to get through and touch the bottom collider before it has been deactivated.

Our player is using:

  • Rigidbody in parent object, no
    Gravity and is Kinematic
  • Character Controller

Our enemy is using :

  • Rigidbody in parent object, no
    Gravity and is Kinematic
  • Top and bottom Colliders in children,
    set to triggers

We have been tweaking around with the Collision Detection and Gravity in our Character, but it still happens.

Should we be using Raycasting to check distance between our character and our enemy in order to deactivate colliders? Is there some other adjustment we can play with to obtain more accurate collision detection?

Triggers are detected in the correct order. Top one jumps first and bottom one after that. They go of in the correct order but with some delay, not big but big enough to make the player enter both triggers before the first one has time to deactivate the second. May it be a problem with Fixed Timestep or maximum time allowed?

Thank you =)