To change position of a Node2d does not change the position of its childs?

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


I have a simple question but it is getting me a little mad. I have a Area2D node and as a child a Collision2D and a Sprite2D. Now the question is, if I change the position of the Area2D this should affect also to the position of the child nodes? If not, which is the way to do this properly?

My problem is, I don’t know why, that setting position in the Area2D (parent tree) it is not changing the position of all its childs.

Thanks in advanced.

:bust_in_silhouette: Reply From: AlexSand

well, it should affect the position at which the children are displayed, which is
But “child.position” is relative to the parent, so this will not change if you change the parent position.
(does it answer your question? If not, maybe you could make a minimal project with the issue to get a more focus answer? )

Thanks a lot. With global_position instead of position it works. And even better, I understand why.


albertosanchezm | 2023-04-09 18:04