Nawar
December 9, 2021, 8:38am
1
Hello!
There are two cars. I would like car2 to exactly follow the rotation of car1 when I use the gizmo rotation.
https://playground.babylonjs.com/#GCT1WE
I found a crutch like this:
gizmoManager.attachToMesh(root2)
gizmoManager.attachToMesh(root1)
I would like to get rid of this crutch, because this adds unnecessary code. Are there any options to synchronize quaternions without this crutch?
Hi!
Seems that when the gizmo manager attached to one of the meshes, it changed its scaling and rotation:
vs
If I force the two to have the same scaling and rotation before attaching the gizmo, then they stay synchronized:
root1.scaling = new BABYLON.Vector3(1, 1, 1);
root1.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0,Math.PI,0);
root2.scaling = new BABYLON.Vector3(1, 1, 1);
root2.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0,Math.PI,0);
gizmoManager.attachToMesh(root1)
Sync rotations with Gizmo | Babylon.js Playground (babylonjs.com)
2 Likes
Nawar
December 9, 2021, 2:51pm
3
Thanks for the answer!
This means that when adding a new mesh to the scene, I just have to explicitly specify not only quaternions, but also scaling. Then the turns coming from the gizmo will be correct.
1 Like