Synchronize rotation/orientation of the mesh


I have 2 identical scene on 2 browsers.
And I have a mesh, that I can move and rotate using this GizmoManager :

        this.gizmoManager = new BABYLON.GizmoManager(this.scene);
        this.gizmoManager.positionGizmoEnabled = true;
        this.gizmoManager.rotationGizmoEnabled = true;
        this.gizmoManager.scaleGizmoEnabled = false;
        this.gizmoManager.boundingBoxGizmoEnabled = false;

For the position, I found the solution :
For 1st browser, I read obj3D.getAbsolutePosition();, I send the Vector3 to the 2nd browser, then I make an obj3D.setAbsolutePosition(…).

But how to synchronize also the rotation (or orientation of my mesh) please ?
I tried obj3D.rotation.x y and z, but it does not make the sync like I want.

Thanks for advance.

@sybaris when you use the gizmos they will modify the mesh’s rotationQuaterion, when rotationQuaternion is being used .rotation is disabled for performance reasons, so syncing the rotationQuaternion should achieve what you are looking for.

1 Like


Wonderful, it works using rotationQuaternion :slight_smile:

Thanks for your answer…