0 votes

Is it possible to calculate the global position of the corner of a tile in a TileMap?

Corner of the TileMap

Godot version 3.3.3 Stable
in Engine by (26 points)

hey, it would be nice to know if my awnser did or did not help you!

1 Answer

0 votes

I suggest you read the Documentation. It solves your question and more that could arise. This is exactly taken from the docs in the map_to_world method: "Returns the local position of the top left corner of the cell corresponding to the given tilemap (grid-based) coordinates. To get the global position, use Node2D.toglobal"

In summary use map_to_world(Vector(x,y)) (you need to pass it the tiles coordinates in a Vector2) to get the local position, and then use to_global(your_local_position) to transform it into the global position.

by (418 points)
edited by
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.