[solved] Can't a node be a child of a node?

Hello everyone !

I’ll try to explain my problem with my approximative english.

My problem is that I want to move a node (let’s call it node1) with another node (let’s call it node2).
for example :

Node node1 = new Node();
Node node2 = new Node();

node2.move(0, 5, 0);

With this, node1 is supposed to move the same way than node2, as a good child is meant to do, and his local translation will be (0, -5, 0) too. However, when I try to execute the code, node1 didn’t move, although node2 had effectively move to (0, -5, 0).

Did I do something wrong ? Is there a way to fix my problem ?

Here is what I’m actually trying to do : I want to set up a camera that moves around a Spatial, always looking at it, and following it. In order to do it, I would like to create a pivot node which would be a child of the spatial’s node, and a camera node child of this pivot node. Want I want is : when I rotate the pivot note, the camera node, with some offset, moves arount this pivot.

Well, thank you for reading, I hope I made myself understand.
Have a good day!

Yes, it can.

Each node/spatial has a local transform. If you move a parent node, every child node moves as well with it.

Does the child’s local transform change? No, because local transform is relative to the parent transform.

If you want to obtain the world position use the getWorldTranslation method etc.

This article might be useful:

Thank you, you solved my problem. I didn’t know there was a Local and World translation. I guess it is a basic notion… But anyway, thanks a lot for your answer and your time!