CharacterController and end of collision

Hi, I am making a 2d-platformer game in which the player can control gravity and have some issues regarding hit detection. As of now, I am using a CharacterController to move my character.

I need to be able to know when my character has left the ground. OnCollisionExit does not exist for CharacterController, so that won’t help. The isGrounded function does not work, since the char could be walking on the ceiling or on walls. I guess I could find ways to code around that, but I was hoping there would be an easy/practical solution already.

Hey Vønce !
You can use one of the controllers functions called isGrounded.
Put this in your Update function!

if (controller.isGrounded) 
{
   
{
else 
{
//Gravity code
}

I think this should work? :slight_smile:

I found a (in my eyes) decent solution, just checking the CollisionFlags that CharacterController.Move returns. Checking for CollisionFlags.None lets me know if the character has left the ground.