+1 vote

Hello, if i had a parent node that has a child, like this :

Parent
    Child

The Parent node has position(x,y), how can i get the position of the parent node in the child node, in GDScript i can use get_owner(), but i need to do it in GDNative.

asked Mar 25 in Engine by soulldev (49 points)

1 Answer

–1 vote

You can use get_parent() to access parent node from child node.

print(get_parent().name) # Will print parent node 
print(get_parent().position) # Will print parent node position

I'm using Godot 3.0.

Hope this will helpful

answered Mar 25 by atopetrick (120 points)
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 How to use this Q&A? before posting your first questions.