TileMap world size

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

how to calculate the world size of a TileMap with godot4 ?

:bust_in_silhouette: Reply From: zhyrin

TileMap.get_used_rect(). You might need to multiply by the tile size, but I don’t think so.

:bust_in_silhouette: Reply From: ubuntu-user
var rect = m_tilemap.GetUsedRect();

var tile_size = m_tilemap.TileSet.TileSize;

Rect2I result = new(rect.Position, rect.Size * tile_size);