Search code examples
c#unity-game-enginegame-developmentphysics

Why does my character stop on nothing in my 2d unity game?


While walking in my 2d platformer my character with a square boxocollider2d will sometimes stop on seemingly nothing. It could sometimes be because it is hitting another box collider set to a trigger.

All the components on my character, including the Box Collider 2D stats: All the components on my character, including the Box Collider 2D stats


Solution

  • In code, make it so that the collider is levitating slightly from the ground below it. That's how most games do it. Helps you handle stairs too. If you can't do that, give it a rounded bottom (like a capsule collider 2D? I forgot what it's called in Unity 2D). Otherwise, it gets stuck everywhere.