Why node setParent will remain the position default?

In some case,i will set the parent position firstly,then create the child node and setParent.But we have the default processing that remain the child position.I want the child node move with parent node.Now,i need to set the child node pisition Vector3(0, 0, 0).Can we make a var to control if the child node remain position?

Instead of calling setParent, you can just manually set the parent without retaining the current position like below:

child.parent = parent;
2 Likes

It works!Thanks for your reply. :smile:
I saw the warning of setParent method then i thought that the parent accessor will like the method.Some small… advice,we make a parameter to control setParent method if it remain position will freer to coder?

we do already have setParent and .parent as Blake said

and an intensive doc about it: Parents and Children | Babylon.js Documentation (babylonjs.com)

2 Likes