The gizmo control does not work at all after loading gltf models

Hello babylon, since PlaneRotationGizmo modification last time, I find that the loaded gltf model cannot be rotated at all, so I rewrite the verification code of irregular scaling.As shown in the following code, the rotation error caused by non-uniform scaling is not because the node itself is non-uniform scaling, but because its parent is non-uniform scaling, so I relaxed the check criteria for non-uniform scaling. This also allows you to select a mesh and rotate it to world coordinates without any problems.

 const nodeScale = new Vector3(1, 1, 1);
            const nodeQuaternion = new Quaternion(0, 0, 0, 1);
            const nodeTranslation = new Vector3(0, 0, 0);
            this._handlePivot();
            this.attachedNode.getWorldMatrix().decompose(nodeScale, nodeQuaternion, nodeTranslation);
            let nodeParentScaleCheck = new Vector3(1, 1, 1);
            if (this.attachedNode.parent) {
                nodeParentScaleCheck = this.attachedNode.parent.absoluteScaling
            }
            const uniformScaling = Math.abs(Math.abs(nodeParentScaleCheck.x) - Math.abs(nodeParentScaleCheck.y)) <= Epsilon && Math.abs(Math.abs(nodeParentScaleCheck.x) - Math.abs(nodeParentScaleCheck.z)) <= Epsilon;
            if (!uniformScaling && this.updateGizmoRotationToMatchAttachedMesh) {
                Logger.Warn("Unable to use a rotation gizmo matching mesh rotation with non uniform scaling. Use uniform scaling or set updateGizmoRotationToMatchAttachedMesh to false.");
                return;
            }

If this problem is modified later, please inform me to update the version.

cc @Cedric

Please open a PR on the repo so qwe can test, review and discuss it.
The forum is not a good place to keep code like this.

1 Like

page:Test unicode | Babylon.js Playground (babylonjs.com)