Hi,
I need to store the initial value of a charachterbody2D object, so I use this :
func _ready() -> void:
initial_position = position
But if the parent object get moved or resized in any way (even in the editor before running the game), the value doesn’t point to the local initial_point anymore.
You need to do some inverse transform matrixing. Although you would be better off using that position and set the node a top_level then just update the position manually. Or use a remote transform node to move it for you and have it ignore scale.
The problem being that even the global position is not correct, because the parent get moved.
I need this position to get the object to move back to its original location.
I don’t think these would work, because I would still need to know the original position of the object, but the parent object can be resized and moved.
That’s why I need the local coordinate, so no matter what happen to the parent, these coordinates stay true.