A query on parent node-child node relationship

Hi…



As per ‘scenegraph for dummies’ a spatial moves/rotates with its parent node



I make a geometry and move it to some point.

Then I make a node, and move it too.

Now I attach earlier geometry to the node.

I expect geometry to remain at its position, but node’s prior move is transferred to it.Why is it so, as it was not attached to the node when node was moved.

Is it correct behaviour or my understanding is wrong?



Manish

@mghildiy said:
I expect geometry to remain at its position

Then you have wrong expectations

localTransforms of a spatial are always relative to it's parent even if they were set prior to attachment. So when you do

node.setLocalTranslation(10,0,0);
spatial.setLocalTranslation(10,0,0);
node.attachChild(spatial);

the world translation of the spatial will be 20,0,0 because the parent Node's transforms are applied to it.

Move the node, attach the spatial and that's it.

so when I attach a child to a node then all previous oprations on parent are transferred to child…

and when i detach effect of all those parent oprations on child(both prior to attaching and after attaching) is nullified…

hmmm…

Theres no “operations transferred”, its simply attached to it. Expecting it to stay there is like expecting to stay in the air after your father puts you down from his shoulders. And please STOP posting questions again and again, especially opening new threads for them! :x

“I had a cup holder on my desk and then I installed it in my car. Why isn’t it on my desk anymore?”