[How to has the same rotation between child Mesh and parent Mesh through setParent Method]

Hi everyone, i think when i setParent the rotation of my children mesh will be the same with the parent mesh. But it is wrong. How to get the same rotation between children mash and parent mesh through using setParent method.
This is my playbackground.
How to reach correct rotation between parent Mesh and child Meshwhich seted setParent | Babylon.js Playground (babylonjs.com)
Thanks for reading my question

Hello :slight_smile:

When you do :

bottomPlane.setParent(plane);

It simply means that plane become the parent of bottomPlane. Meaning that the bottomPlane will move with the plane, and will have its transforms (rotation, position, etc) relative to its parent.


So, if you want to setParent, and as well have the same orientation, either you do :

bottomPlane.rotation = plane.rotation.clone();
bottomPlane.setParent(plane);

or :

bottomPlane.setParent(plane);
bottomPlane.rotation = new BABYLON.Vector3.Zero()

Both will have the same result.
In the first case you put the same orientation, and then you set relationship. In the second case, you set relation ship, and then you set rotation to zero on the child to align.


++
Tricotou

1 Like

thank you very much, it’s help me :smile: