Glb useRightHandedSystem rotationQuaternion

set scene.useRightHandedSystem to true
load a glb file
check the rotationQuaternion of a mesh.
it is set to null
see

cc @bghgary

This is expected. In your example, result.meshes[0] is the __root__ mesh created by the loader. Since glTF is right-handed, the loader only adds a coordinate-system conversion when the scene is left-handed. With useRightHandedSystem = true, no conversion is needed, so the root keeps its default rotationQuaternion of null.

A null quaternion means the mesh uses its Euler rotation instead. If your code needs a quaternion, you can initialize it without changing the current rotation:

hero.rotationQuaternion ??= BABYLON.Quaternion.FromEulerVector(hero.rotation);

Ok.

But it just does not seem right.

a) LHS has rotation in quaternion . So should RHS
Two should be consistent.
One could for example say, if no conversion is needed in RHS then why even add _root_

b) rotationQuaternion is “native” to GLB/GLTF.

If one is not careful, which is what happened in mycase, can lead to subtle errors.

Perhaps.

__root__ also provides a common parent for the imported model, so it still serves a purpose without coordinate conversion.

While initializing it with an identity quaternion in right-handed scenes would make the two cases more consistent, this has a backwards compatibility concern. Code currently using the root’s Euler rotation would then have that rotation ignored. It’s hard to tell how many users rely on this. I don’t have a good solution that would maintain backwards compatibility.

I get your concern about backward compatibility.
Bummer.
I guess, just update the document to point this out and maybe just update babyonjs lite, given that we are starting with clean slate there

I’m putting together a PR to clarify this in the docs.

Babylon Lite only supports left-handed scenes and already uses a quaternion for rotation on the glTF root, so it doesn’t have this issue.

The documentation update has merged and clarifies this behavior.

Surprised that Babylon Lite only supports LHS. Given all the enthusiasm around GLB/GLTF I would have though RHS would be the default choice.

That was a REALLY itneresting dicussion. But LHS won :slight_smile:

I’ve never known anything but +Y Up export.:backhand_index_pointing_down: :backhand_index_pointing_up:

That just a “plain” view from the origin of web Browsers (only XY), RHS rules in CAD, Math, nature, economy, society, and real life!

Let’s agree to disagree :smiley:

Coming from the mechanical CAD side, keeping useRightHandedSystem = true is a lifesaver whenever we bring engineering assemblies into Babylon. Since the glTF 2.0 spec is already right-handed, Babylon’s default left-handed mode has to inject that __root__ transform with a negative scale and a rotationQuaternion to flip the handedness, whereas in RHS mode an unrotated node doesn’t need a synthetic quaternion override so rotationQuaternion stays null unless the GLB node explicitly defines rotation in the file or you call mesh.rotation.toQuaternion(). Whenever we tessellate STEP models for WebGL scenes (usually referencing Free Online STEP to STL Converter — 3D Printing Mesh Optimization (2026) for chordal tolerance settings), baking the coordinate orientation before glTF export saves a lot of headache with mirrored normals and quaternion sign flips.

…and that’s why RHS is the real thing; like earth spins, travels around the sun, common sence.

You will like that then: feat: right-handed coordinate system via build-time resolve condition by deltakosh · Pull Request #871 · BabylonJS/Babylon-Lite

When scene.useRightHandedSystem = true is set before importing a .glb, Babylon skips creating the left-handed conversion quaternion on the root node, and if a child glTF node only has a translation or identity transform in the JSON without an explicit rotation array or TRS animation channel, the loader leaves mesh.rotationQuaternion as null and falls back to mesh.rotation Euler angles until you assign Quaternion.Identity(). We ran into this exact behavior while building browser WebGL multi-CAD assembly viewers for STEP/RVT/DWG models (we cover the coordinate system and GPU pipeline setup in Large DWG Hardware Acceleration, GPU Tuning & Viewport Lag Troubleshooting Guide | Gstarcademy), so initializing mesh.rotationQuaternion ??= BABYLON.Quaternion.Identity() right inside onSuccess keeps gizmos and quaternion transforms consistent across both coordinate modes.

Just for context, we really shouldn’t be adding both a negative scale and a rotation. It really should be just one negative scale on the correct axis (i.e., a negative scale of Z and a 180 rotation on Y is equivalent to a negative scale on X). We didn’t realize that in the beginning for Babylon.js, but we were stuck because of backward compatibility rules.