Search Unity

Tile rotation sometimes doesn't make any sense ...

Discussion in '2D' started by Aurigan, Jan 8, 2021.

  1. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    I'm working on some code to turn a tilemap into a mesh. In order to do this, I'm going through each position in the tilemap and grabbing the verts, uvs, etc. Then (because rule tiles can rotate and mirror(scale) tiles) I'm copying the tile rotation and scale.

    In this screenshot the tile is rotated - this looks as expected.
    upload_2021-1-7_20-48-16.png

    In this screenshot the same tile has been mirrored and rotated ... but the rotation is showing all 0's.
    upload_2021-1-7_20-47-53.png

    Umm ... am I missing something here? It looks like the Unity inspector (and internal tilemap data) are just reporting bogus rotations.
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Could you share a screenshot of how Grassland@128x128_195 should look like normally?

    The values you see in the Grid Selection Inspector are decomposed from the Transform Matrix of the Tile, although it does look strange that the negative x scale and a 270 rotation would produce a mirrored x result.
     
  3. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Sure thing:
    upload_2021-1-8_7-28-39.png
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Thanks! Will check this out.