How to get TextureButton position in GDScript?

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

I’m new to this and I have looked everywhere for an answer but can’t find it.

I need to get a TextureButton position so I can set another node position, but I just can’t seem to find a way to do it.

I would appreciate any help.

:bust_in_silhouette: Reply From: fpicoral

For 2D

There are two types of position, the “relative” one and the global one.

The first type is relative to the parent of the node and can be accessed with Node.position. It returns a Vector2.
The other one, the global one, gives the global position, and can be accessed with Node.global_position. It also returns a Vector2.

Where did you search?
These informations are avaliable in the docs, which you can see online or in the editor.

If you want the 3D position, search the docs, I’m not used to 3D so I can’t help you with that. I may be wrong but I think that, in 3D, you need to use Node.get_position() which returns a Vector3

If this answer solved your problem, please set it as the best answer.
Good luck with your project