Positions of transform nodes, meshes seem off when loading a GLB in as an AssetContainer

Our 3D team have supplied a GLB for one of our sites. In this GLB, they have setup a camera which is attached to a Transform Node. A seperate transform node is setup and acts as the camera target. Both have associated animations.

The position of the Camera’s transform Node and the position of the target Transform Node both have similar positions, but when I point the Camera to the target, it seems to be point at a point completely different to where I expect.

I have read somewhere that it could be related to the local positions of the nodes in the Asset Container vs the world positions. But the transform nodes are all contained in the root node so I don’t understand why they wouldn’t be relative.

Could it be because of the difference between right-handed and left-handed spaces?

Can you clarify this further for me?

By default the world coordinate system used by Babylon.js is left-handed (lhs), whereas geometries in .gltf files are right-handed (rhs). So, at loading time, we create a root node (name __root__) for the meshes loaded from the .gltf file, to transform rhs to lhs (it’s a 180° rotation around Y and a -1 scale on Z axis).

Try to set scene.useRightHandedSystem = true just after you load your scene and see if that helps: it will still create a root transform node, but this time with the identity transformation.

4 Likes

Interesting, I will give this a try