How to get a Node's absolute position in the world

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

If I have a parent Node2D with transform’s translation at (50, 0) and a child Node2D with transform’s translation at (100, 0).

When I type parent.position, I get (50,0).
When I type child.position, I get (100,0).

These are their respective node’s relative position, but not the absolute position in the world. The child’s absolute position is its relative position added to the parent’s relative position: (50,0) + (100,0) = (150, 0)

How do I get the absolute position of a node?

by using child.global_position or parent.global_position

supper_raptor | 2020-04-25 12:38