0 votes

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

asked May 2 in Engine by jburger (15 points)

1 Answer

+2 votes
Best answer

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

https://docs.godotengine.org/en/3.2/classes/class_tilemap.html#class-tilemap-method-map-to-world

answered May 2 by kidscancode (17,762 points)
selected May 3 by jburger

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 https://github.com/godotengine/godot/issues/37394

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.