Hello
Guest
Home
Help
Search
Login
Register
2D Toolkit Forum
»
2D Toolkit
»
Support
»
[TileMap] Convenience method to convert a world coordinate to a tile coordinate
« previous
next »
Print
Pages: [
1
]
Author
Topic: [TileMap] Convenience method to convert a world coordinate to a tile coordinate (Read 5068 times)
iopixel
2D Toolkit
Newbie
Posts: 6
[TileMap] Convenience method to convert a world coordinate to a tile coordinate
«
on:
December 23, 2012, 10:00:03 pm »
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 !
Logged
unikronsoftware
Administrator
Hero Member
Posts: 9709
Re: [TileMap] Convenience method to convert a world coordinate to a tile coordinate
«
Reply #1 on:
December 26, 2012, 03:02:28 am »
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.
Logged
iopixel
2D Toolkit
Newbie
Posts: 6
Re: [TileMap] Convenience method to convert a world coordinate to a tile coordinate
«
Reply #2 on:
December 26, 2012, 10:08:53 pm »
Great, thanks !
Logged
Print
Pages: [
1
]
« previous
next »
2D Toolkit Forum
»
2D Toolkit
»
Support
»
[TileMap] Convenience method to convert a world coordinate to a tile coordinate