How to get a tile's coordinates

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jburger

Hi, i was wondering if it was possible to get a tile’s coordinates in the 2d world given its TileMap coordinates or its id

:bust_in_silhouette: Reply From: kidscancode

If you have the tile’s coordinates in map space, use map_to_world() to convert to world space.

Note: map_to_world is actually not truly world space, it will give you the coordinates of the tile in pixels relative to the tilemap’s origin. If it is (0,0) that will be the same as world space, but better check.
See TileMap map_to_world and world_to_map do not account for TileMap node positions that are not at (0,0) · Issue #37394 · godotengine/godot · GitHub

Zylann | 2020-05-03 01:58