Search Unity

Is it possible to create a staggered isometric tile map (NOT diamond)?

Discussion in '2D' started by sandorlev, Apr 11, 2021.

  1. sandorlev

    sandorlev

    Joined:
    Jun 30, 2019
    Posts:
    2
    Hello,
    I'm creating a 2D isometric game and wondering if it's possible to create a staggered tile map like this: tiles - Difference between "staggered" isometric and "normal" isometric tilemaps? - Game Development Stack Exchange.
    My main issue is Grid doesn't support this by default as far as I can tell, and even though it's possible to draw a tilemap such that it'll have that staggered look it has some problems: the tile indices will be all over the place, it'll be difficult to find the map bounds, and so on.

    I haven't been able to find any documentation on this particular issue. I'd really like to use Unity's Grid and Tilemap objects as opposed to creating something from scratch because they have a lot of useful abstractions, although I'm open to e.g. creating my own Grid subclass if that helps.

    Thanks!
     
  2. rarac

    rarac

    Joined:
    Feb 14, 2021
    Posts:
    570
    I dont get it

    do you call this staggered just because you dont lay the tiles in a diamond pattern?

    the only difference im seeing here is the axis coordinates which you can just use math to convert the positions
     
  3. sandorlev

    sandorlev

    Joined:
    Jun 30, 2019
    Posts:
    2
    Yes. Do you have a suggestion?
     
  4. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,513
    I'd probably solve this problem with an extension method:
    Code (CSharp):
    1. public Vector2Int ToStaggeredCoordinate(this Vector2Int gridCoord)
    2. {
    3.      // do math to convert
    4.      return staggeredCoordinate;
    5. }
    Then create another method to convert back. When you need to go from "gridspace" to "staggeredspace" you call one of the methods. Vector3Int if you need the z.
     
    rarac likes this.