- Home /
CharacterController sinking on edges of colliders
Hello, I am working on a 2D game that uses a CharacterController. Everything works great, except for the fact that since the collider is a capsule, when you are on the very edge of a flat, rectangular collider it kind of dips down a bit and gets "stuck" on the rounded part of the capsule.
I've tried checking the normal.y and seeing if it is less than a certain value, and then disabling the collider, but I don't think this is a good solution and I'm having trouble figuring out how to determine when to re-enable it. Does anyone have any solution to prevent this from happening? Thanks in advance!
So the method I've been trying involves Raycasts on either side of the controller to see if the character is on the edge. I then try to restrict Y movement while on an edge, but it still doesn't quite work, there are all sorts of glitches going on. $$anonymous$$aybe I'm on the right track, though.
Any other ideas? How do people deal with CharacterControllers and the edge of platforms? I feel like this would be a common issue, even if it is not a 2D/2.5D game. Thanks!
Ok, so I almost have this working using Raycasts on either side of the character. The problem is getting them aligned properly so they don't trigger ground contact too soon when co$$anonymous$$g from the side. This method is starting get wonky, surely there is another way?
Your answer
Follow this Question
Related Questions
Top Down 2d (PC): Gameobjects' Colliders intermeshing 1 Answer
Guidelines for using rigidbody, collider, CharacterControllerScript, etc? 3 Answers
Hi can I use DOTween as my 2D charatercontroller? 1 Answer
character jumps when collids with other objects 1 Answer
Picking up items with Rigidbodies 2 Answers