Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

Tile Map [Bug?] Maybe YZX swizzle and ZXY swizzle are exchanged wrongly, aren't they?

Discussion in '2D Experimental Preview' started by RyotaMurohoshi, Jan 6, 2017.

  1. RyotaMurohoshi

    RyotaMurohoshi

    Joined:
    Jun 20, 2013
    Posts:
    21
    I have a question about Grid Component's Swizzle property.

    From Swizzle description at reference guide https://docs.google.com/document/d/1fGYUBPJrJknCsYbAl4z3cOP8x6kealwjZfa2DwcXSgA/edit

    > Swizzles the cell positions to other axii. For Example. In XZY mode, the Y and Z coordinates will be swapped, so an input Y coordinate will map to Z instead and vice versa.

    In my understanding,

    * XYZ swizzle means that tiles on XY plane with Z normal axis. Used with XY tilemap orientation.
    * YXZ swizzle means that tiles on YX plane with Z normal axis. Used with YX tilemap orientation.
    * XZY swizzle means that tiles on XY plane with Y normal axis. Used with XZ tilemap orientation.
    * ZYX swizzle means that tiles on ZY plane with X normal axis. Used with ZY tilemap orientation.

    But, unlike my expectation YZX swizzle and ZXY swizzle behaviours are

    * YZX swizzle setting, Grid plane is XZ plane with Y normal axis.
    * ZXY swizzle setting, Grid plane is ZY plane with X normal axis.

    Is my understanding wrong? Or Grid Component bug?
     
  2. RyotaMurohoshi

    RyotaMurohoshi

    Joined:
    Jun 20, 2013
    Posts:
    21
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    6,919
    The Grid swizzle just means transposing the output from the layout (logical cell-space) to local-space. It has nothing to do with the TileMap as the Grid component isn't even aware of the TileMap's presence. I assume you already know this but it's very important to state.

    The Grid doesn't have planes either, even the Rect layout is 3D so it's effectively a Box volume layout however you can think of planes if you use Cell Position Z = 0 all the time so only using 2 axis.

    XYZ simply means no transposition is done so the output of the layout stays the same.

    YZX means that the X is output as the Z axis, Y is output in the X axis and Z is output in the Y axis. In other words, the Y is position in X, Z is positioned in Y and X is positioned in Z.

    A cell layout output of (10,20,0) with a swizzle of YZX will output (20,0,10)
     
    Last edited: Feb 12, 2017
unityunity