Hello Guest

Author Topic: [TileMap] Convenience method to convert a world coordinate to a tile coordinate  (Read 4219 times)

iopixel

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Hi,

I can do this myself using the camera / tilemap parameters but before doing it, can you tell me there is a method to convert a world coordinate to a tile coordinate ?

Thanks !

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
tileMap.GetTileFracAtPosition will transform a tile position from world -> tile space. The rounded / floored x & y values should give you the tile indices in both axes. The function returns false if the world position is out of bounds.

iopixel

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Great, thanks !