Preventing CharacterController sliding down edges on platforms, ground detection.

Hey guys!

Sorry if this has been answered before, but I’ve been looking for some solution to this for weeks, and I still haven’t been able to figure it out.

So here is my problem:
I’m using a CharacterController for my player’s movement, and it works wonderfully for every type of terrain or slopes I want in my game, except for the edges of platforms. Because it uses a capsule collider, it “sinks” down the edge until it’s no longer touching the platform before falling down like in the first picture.

134841-pic1.png

I’m working with -y value for gravity and the character is able to jump when grounded (The ground check I use now is controller.isGrounded)

What I want is for the CharacterController to behave like the second picture, but ONLY on the platform edges, as it works perfectly in all other cases as of now.

I’ve tried a bunch of different solutions with Raycasting/BoxCasting for the GroundCheck, but I haven’t been able to make it work like I want. I’m still pretty new to coding, so this has me stumped.

Any suggestions?

EDIT: To clarify: I’m not using the built in physics.

Are u using physical materials and do u use PhysicMaterialCombine.Maximum when jumping?

Maybe this might help ? Reddit - Dive into anything