0 votes

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.

in Engine by (33 points)

1 Answer

+2 votes
Best answer

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

by (519 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.