Just now noticed a strange interaction between Character Controller and other colliders.
I have a character with a Character Controller. I move him using the Move function (the movement speed is quite slow). I use the OnTriggerEnter and OnTriggerExit functions to detect when the character collides with other objects. The problem is that these functions are triggered later than when the character touches another object. This is shown in the images below.
If I replace the Character Controller with Capsule Collider and add Rigidbody to another object and move the character manually, the OnTriggerEnter function is triggered exactly when the character touches that object.
Why does this happen? Why does Character Controller incorrectly detect collision with other objects?
It’s a consequence of frame based movement and the fact that the character controller always uses sweep based movement. If you experiment with the collision detection mode of the rigidbody then you may be able to make it behave like the character controller.
One thing you could try is reducing the Skin Width of the Character Controller. I encountered a similar issue where standing on a RigidBodymoving vertically was causing my Character Controller’s movement to stutter when being pushed vertically.
I set my Skin Width to 0.0001, disagreeing with their recommendation for 10% of the radius, and haven’t had the same issues since when interacting with physics colliders. I don’t know if the same will apply to OnTriggerEnter and Exit, but I’d imagine so?