Mesh with scaling(1, 1, -1) will set an unbelievable scaling when drag positionGizmo

Before dragging:


After dragging:

It occurs from v4.2.0.I didn’t see the doc mention we should set scaling by what type.

Hello!

Both transformations are equivalent, so they have the same result. :slight_smile:

It’s still weird. It there an explanation for that?

There are multiple operations in Gizmos and one of them needs to decompose the object matrix to translation/orientation/scaling and recompose it after.
Because of a negative scale, the decomposition finds a solution that may be different from the intended.
Basically, it’s not possible if the scale is -1 or if it’s a composition of rotation that gives the world matrix.

4 Likes

And the cause of the negative scale is that this transformation is applied to loaded GLTF meshes to convert from their native right-handed system to Babylon’s native left-handed system :slight_smile:

image

2 Likes

Yes, thanks. I figured this part just didn’t understand how it can result in rotating other axes. Beautifully explained by @Cedric. Thx Guys, as always you rock :smiley:

2 Likes

Thanks for your reply. :smile:

Thanks for your reply. :grin:

I have another question.If i import a gltf mesh,and i attach a gizmo to the mesh.It will change the mesh scaling and rotation when i drag positionGizmo.How can i resolve it?

IIRC gltf are in right hand coordinates. Setting you scene with RH will make the imported gltf to not have a -1 scale.

scene.useRightHandedSystem = true;
1 Like

It just resolves that import mesh with -1 scale.If i set the scale -1 manually,the result is correct now?It shows correctly,but it set rotation and scaling in another way.

Yes, I think so. If you want more control on the gizmo result, you can add an onDrag observable and ‘tweak’ the resulting angles/scaling.

1 Like

Yes,i add an dragObserver to change the gizmo result.I just think if the result should distinguish -1 and 1.Thanks for you reply. :smile:

1 Like

PR New flag to preserve scaling when using gizmos by CedricGuillemet · Pull Request #12385 · BabylonJS/Babylon.js · GitHub

1 Like