Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change collider in individual tile in tilemap

Tags:

unity3d

I am using tilemap in unity for level building. I need colliders on my tiles. If I add a tilemap collider to the tilemap it generates a collider around the tile, however I need to edit these colliders and have different colliders for every tile.

How could i do this?

Wrong collider: enter image description here

What i want to achieve: enter image description here

like image 856
Vít Vohralík Avatar asked Nov 05 '19 08:11

Vít Vohralík


2 Answers

In your case you have square tiles and the Tilemap Collider box fits it naturaly.

To edit the Tilemap Collider, go to the Sprite Editor in the Sprite you're trying to use and modify how you want it to by clicking in Custom Physics Shape

![Sprite Editor

Then, once you have the right shape, reset your Tilemap Collider and you're good to go.

like image 157
Tiago Martins Peres Avatar answered Oct 19 '22 19:10

Tiago Martins Peres


Updated Answer for newer versions of Unity 2019+:

You now have to open the sprite sheet in the sprite editor and then select "Custom Physics Shape" under the Sprite Editor dropdown.

enter image description here

like image 34
Kalib Crone Avatar answered Oct 19 '22 18:10

Kalib Crone