Upgrading to BJS4 - mesh no longer rotates

#1

In BJS3, the code below would load a gltf file and then translate and rotate all of the meshes in the file. After upgrading to BJS4 (4.0.3) the meshes are translated but not rotated.

As a diagnostic test, the code below console.logs the mesh objects before and after the translate/rotate operations are performed allowing inspection of the objects in the debugger to confirm that the .position properties of the meshes are modified by the .locallyTranslate() call but the .rotation properties of the meshes are not modified by the rotate() call.

Also, this is my first post on the forums here so hopefully I’m guessing at how do do code formatting correctly here, there doesn’t seem to be a way to preview the markdown before posting which is odd.

        SceneLoader.ImportMeshAsync(null, this.mRootUrl, this.mFilename, scene, (progressEvent) => {
            console.log("loading mesh"); // progressEvent);
        })
        .then((imported) => {
            console.log("model loaded");
            imported.meshes.forEach((mesh) => {
                console.log("processing mesh");
                console.log(mesh);
                mesh.locallyTranslate(new Vector3(10, 10, 10));
                mesh.rotate(Vector3.Right(), -1.57);
                console.log(mesh);
                console.log("done procesing");
            });
        })
        .catch((reason) => {
            throw reason;
        });
#2

Two updates: (1) I think this is a gymbal locking issue, as I’m able to rotate the meshes in my current file around the up and forward axes but not around the right axis but in the playground I can rotate other meshes in other files around any of the three axes and (2) I think this issue may be related to the change in gltf y-up handling that came in with v4, such that the internal rotation values in this file and the gltf y-up setting are now resulting in gymbal locking about the right axis.

#3

hello and welcome to the family!

Did you check our module doc: ES6 - Babylon.js Documentation