How do i can get a position of another object scene?

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

I already tried in several ways but I could not in any way

  • 2D node
  • All objects are in the same node
  • I want to change position of one object through another object script, if possible

What do you mean with an object scene. Do you mean an object inside another scene? What kind of position are you looking for? 2D? 3D? Please be a little more specific. Thanks.

Jowan-Spooner | 2019-05-13 19:47

translation is the position property for 3D, I don’t know if it’s the same for 2D.

yourNode.translation

Magso | 2019-05-13 21:37

:bust_in_silhouette: Reply From: Jowan-Spooner

With ‘in the same node’ you, mean children of the same node I guess. To answer your question for 2D Nodes position instead of translation.

In that case you can use something similar to this inside your script:

get_parent().get_node("NameOfNode").position= mynewposition

You can get any variable you need, this way.

hope it works

How, Yes, that’s right! thank you very much! i am beginner with this engine and i still don’t know the right terms os words to explain certainly rs, then thank you again

Torico | 2019-05-14 19:08