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?
Yes here is a Playground to demonstrate https://playground.babylonjs.com/#YE5K3X#13 Also you can download the original worm from https://preview.punkoffice.com/worm/worm_blender.glb so you can see what the skeleton should look like (Babylonjs skeleton viewer doesn’t show bone length)
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:
- 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. - 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 (github.com) 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.
Hi @ozRocker ! Do you happen to still have the original model? The link now returns 404.
We’re in the process of reworking the glTF exporter, and we want to be sure that this issue has been fixed and tested. Thanks in advance.
I found a copy of the GLB and I’ve put it back. The playground should now work