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;
}