GLBexporter exports bones facing opposite direction to mesh

When I export a rigged mesh from Babylon.js the bones are always facing the other way. I tried this with a simple worm (block with 2 bones). As you can see in the screenshot, the exported version has the bone facing the opposite way. Is there a way to fix this?

Adding @bghgary

@ozRocker can you create a tiny repro in the playground?

Yes here is a Playground to demonstrate Also you can download the original worm from so you can see what the skeleton should look like (Babylonjs skeleton viewer doesn’t show bone length)

I can repro, but this may take some time to fix. EDIT: I see this from the export in the sandbox:

yes, then if you put it into rest pose you can see the bone pointing the opposite direction


The sandbox starts at the rest position, so I’m not sure what you mean by this.

Anyways, I’ve determined there is an issue with exporting the model if instantiateModelsToScene is called. Calling addAllToScene works.

Actually, that’s not it. The problem is the names. Somehow making all the names the same (as PG #13 is doing) is causing a problem. Fixing that seems to make it work.

The problem is two-fold:

  1. The exporter doesn’t detect the handedness conversion node well. It expects the node to be called __root__ or it assumes it is not a conversion node. I can make a change for this.
  2. It doesn’t look like the code handles handedness conversion for skins. It may have been working before my changes to how glTF skinning works by accident. This needs further investigation.

glTF export root node removal fix by bghgary · Pull Request #13214 · BabylonJS/Babylon.js ( will fix #1, but we’ve touched this part of the code a lot, so I probably should add some more tests.

Fix is merged. It doesn’t address the underlying issue for skinning export, but it should work for your scenario once the change is deployed.

1 Like