The origin of the child node's tilemap

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

A tileMap created on a child node,it’s origin start by top-left corner of the child node when drawing tiles in engine. But when it starts running, its origin changes to be calculated from the top left corner of the main scene when used “get_cellv()”

(Use mouse detection methods :
get_cellv(world_to_map(get_global_mouse_position) ).

How do I get the tilemap origin to start at the top left corner of the child node?
ps: the child node is Control node,It is used in automatic alignment of VBoxContainer

:bust_in_silhouette: Reply From: IHate

So is the tilemap a parent or a child of the Control node? Either way you should have no problem. You just need to use the proper method. If you are taking a position from the Control node use rect_global_position() and turn it into a map position using tilemap.world_to_map(rect_global_position()).