GLTF loader and implementation of GLTFLoaderCoordinateSystemMode.AUTO


I suspect there is something wrong how coordinate system conversion is implemented in GLTF loader. When I use scene this.scene.useRightHandedSystem = true everything seems to work ok but when I don’t use it things like navigationPlugin and transforming rays to the model local coordinates seem to be break. It looks the z axis values are inverted. For example when I create a debug mesh with navigationPlugin the generated mesh is inverted in z axis and does not align with the rendered model all though navigation plugin is attemping to convert the floor meshes to world coordinate system before using them. The ray also gets flip in z axis and the ray casts stop working entirely so I wonder if the scale -1 in z axis is breaking things there.

Kind regards,

        case GLTFLoaderCoordinateSystemMode.AUTO: {
            if (!this._babylonScene.useRightHandedSystem) {
                rootNode.rotation = [0, 1, 0, 0];
                rootNode.scale = [1, 1, -1];
                GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);

Pinging @bghgary and @Cedric

hi @tlaukkan

Can you try to parent the debug navmesh to the scene root?
The navigation uses the mesh worldtransform, so the scale should be taken into account. But the debug navmesh is not parented to anything so the display might be broken because of that.

1 Like

Hi Cedric

The debug navmesh is parented to scene root. I have similar problems with custom raycast implementation where the gltf model world transformation mirrows everything on z axis versus what is actually rendered. I have switched now the scene coordinate handedness to get things working but I recon it should work the same with either setup.

Kind regards,