Godot Version
4.4.1
Question
So I have been trying to access the global position of a Node2D in my game, for now I have just been printing out the value with print_debug to see the issue.
In one script, I have been doing print_debug(pedastal_a.card_slot.global_position)
, where card_slot is the Node2D in question. This script is attached to a Node2D that is a child of a CanvasLayer of my main scene.
In another script, I used print_debug(home_pedastal.card_slot.global_position)
which is effectively referencing the same Node2D since home_pedastal is pedastal_a, just with a different variable name. This script is attached to a component of a Node2D that I will instantiate into the scene under the same CanvasLayer parent as the previous script I mentioned.
The problem is that these two scripts each print out a different global_position. The global_position that is printed out in the second script is the desired value, but I have not yet found a way to access this value in the first script.
For some more context, the node2D in question does not change position, and when testing I have ensured that I haven’t moved it in any way between the printing of the two. If something is different I guess it would be the time at which the global position is accessed, in which case the second script accesses it later.