Tilemap collider isn't working properly

So my problem is that, even though the collision is detected player’s movement isn’t stopped. Player keeps bumping into tiles which causes buggy behaviour. Images below are showing my collider settings on bothe the player as well as the tilemap.


If I understand you correctly, your character is jittering etc. when it moves against a wall, to which a collision is correctly registered? You probably should stop your character’s movement as soon as a collision is registered? If you keep adding force or use MoveTowards (if your player is a physics based object), it’s no wonder it might jitter etc. if you push it against a wall.

Yeah that’s what I thought but I’m not sure how am I supposed to do that ? Is there some convention to do so ?

That was a problem I had before. You need to change the code of characters movement. Use Vector3 transform position

  • Don’t ever modify the Transform on a GameObject that has a physics object on it. When you add a Rigidbody2D you’re asking it to do so. You should use the Rigidbody2D API to cause movement otherwise you’re just bypassing the whole point of adding it. Use Rigidbody2D.MovePosition, Velocity etc.

  • The warning about constraints isn’t something you should just ignore. Set the body-type to static then it won’t move and costs nothing.

  • Presumably the Tilemap isn’t moving so turn off Continuous. This should only be used by fast-moving bodies where you need to ensure no tunneling occurs.

1 Like