TileMap and imperfect collision

Hello,

I have a slight problem with my collisions. Here is a picture to show the situation :

Each wall tile (and the player) has its own BoxCollider2D. The problem is that the player sometime “block” when walking along the walls. I suppose that because of some floating point imprecision, the colliders are not perfectly aligned (but it’s just a supposition). Note that the blocking is unreliable (sometime the player get stucks, sometime it doesn’t)

I can’t easily use a big collider, because the levels are procedurally generated and will be dynamic, so I kinda need one collider by tile.

Has someone already encountered this problem, and how did you solve it?

Thanks

Definetely the easiest fix will be changing the collider of your player object. My suggestion would be changing it to polygon collider, and raising the sides to form a cup shape.

The colliders that are hitting each other are probably sides of player collider and sides of tiles, due to the imperfection of physics. When this imperfction happens with the diagonal collider, your player instead of “bumping on a wall” will “climb” on the floor.