Hello! I am making a 2d game and i have a character with a polugoncollider2D and the ground tiles(each one has a boxcollider2D)! My problem is that, although the ground tiles’s colliders are all at the same height, my player sometimes gets stuck on them and cannot move forward(so i have to either jump or move back and go forth again).Do you know why this happens?
Here are some images of my player’s collider and the ground tiles’s colliders :
*[Edited] 19/1/16 : The problem has been solved thanks to the great community.If anyone else is having the same problem visit this website and follow the tutorial as it is,it will work great!
Website for 2D collision problems : How to Setup your characters 2D Colliders in Unity – John Stejskal : Software and Game Developer
I’d say it’s PolygonCollider’s small bulges somehow stop at box colliders. Why not try BoxCollider for player too? I doubt you’ll lose much with that.
Nope nothing.Btw i have another small boxcollider2d on his legs so that i can check if he is grounded, i do not know if that could cause such a problem!
Well, then I’ve missed. I didn’t notice that small box - it’s green on green! Well, anyway I can advise reading about such problem here How to Setup your characters 2D Colliders in Unity – John Stejskal : Software and Game Developer My guess didn’t change much)
Ok i will sure check it out! Thank you! 
Don’t use box but line.
The vertical lines coming with the boxes can stop box/mesh colliders because of a lack of precision in values.
You can try with a circle collider on your character though ( but definitely don’t use a mesh collider unless it’s strictly necessary )
I had a set-up like this at one point but I ultimately decided that it was not a good solution. The part of the circle collider that sticks out of the bottom will still occasionally get snagged on tiles, particularly if your player is falling and happens to land in just the right position. Also, when you have your player standing at a ledge (so that they are grounded with the box collider) and then you move towards the ledge, there is a noticeable bump when the circle collider hits the ground.
Maybe these things aren’t an issue for you in your game, but I would still highly recommend trying out a raycasting approach instead.
you should look into raycasting. go easy on the box colliders they stick out
1 Like