Unity - Setting the Tilemaps / Platform

Matthew·2024년 8월 22일
0

Unity

목록 보기
8/9
post-thumbnail

Movement Fixes

  • If you follwed the last tile map tutorial, our tilemap already should have tilemap collider 2D.

  • If you start moving, you'll see our player gameObject moving up and down randomly.
    • This is because our tilemap collider is applied to each individual tiles.

Solution

  • To fix this, add Composite Collider 2D.

    Composite collider 2D merges all of the collider 2D, and in this case it will help merge all of the tiles into one big collider.

  • Make sure you check the Used By Composite in Tilemap Collider 2D, and change body type to Static in RigidBody 2D component.

Static body type do not move under physics simulation. It is an immovable object with infinite mass.

  • Now it should be moving fine!
profile
Growing Game Dev

0개의 댓글