- Home /
OnCollisionExit() too slow
I've been having a problem, and I decided to print out all sorts of values that can help me debug a certain problem. I found out that the function OnCollisionExit() is too slow. When the player jumps, I add to the player's vertical velocity. However, in the next frame, the player is still grounded as OnCollisionExit() has not been called yet, despite the fact that the player:
has vertical velocity.
has a different vertical position.
I played with the Default Contact Offset, and nothing worked. Any ideas?
The next frame or the next physics frame? $$anonymous$$eep in $$anonymous$$d that physics only advances every FixedUpdate (usually fixed at 50 times a second depending on the fixedDeltaTime)
Answer by anthot4 · May 04, 2018 at 08:06 AM
@lowhearted I presume OnCollision Exit is called on the player? The first thing that springs to mind is make sure the object its colliding with has a collider on and not a trigger collider. I presume the player has a Rigidbody on too?
If that doesn't work have a look at these two links: https://docs.unity3d.com/Manual/ExecutionOrder.html https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnCollisionExit.html