Character Controller Side Collision

I have a player+character controller colliding with a platform. I apply gravity through script when the controller is grounded. Unfortunately, this method fails when the character is standing on the side of a platform:


As you can see, the character appears to fly over the platform. This occurs because the character controller believes it is grounded. Is there an elegant way of solving this problem (perhaps one of the controller’s parameters)? If not, what could I do?

Thank you!

you could adjust the collider of the platform and make it smaller, that way it’ll look like the character is standing on the platform, like cut a bit off the edges, or instead of using capsule collider maybe try something more accurate, polygon or even edge collider with a little bit of work to adjust it properly.
EDIT: you could add an empty game object to the character that is in it’s shape, and check whenever the that gameobject collides add gravity to the character, use GetComponent to get the character’s gravity, or this.gameObject.parent