I had some problems with the GLTF2Export exporter, and after finding the cause decided to leave a post documenting it to help anyone experiencing the same problem.
The following is an example of problem reproduction.
It is well known that babylonjs uses a left-handed coordinate system, while gltf uses a right-handed coordinate system. Therefore babylonjs creates a transform node for the gltf model when it is loaded to solve the problem of different coordinate systems. This will give us a scaling of {x:1,y:1,z:-1}.
To make it easier to do transformation calculations on the model, I customarily create another standard transformation parent node for it.
And this will leave a hidden problem for GLTF2Export export. Because when exporting GLTF, you need to remove the right-handed to left-handed transform node, the exporter not only requires removeNoopRootNodes to be true, but also checks the matrix of the rootNode, and changing the rootNode will cause the checking to fail, and the transform node will not be removed correctly.
If the example
let tn = new TransformNode('rotnode', scene)
addmodel.rootNodes[0].setParent(tn)
These are equivalent. A scale of -Z with a rotation 180 around Y is a scale of -X.
The exporter will stop removing the RH to LH conversion node if it’s not clear whether it’s okay to do so. In your case, if you add another root node, it will break the logic of removing the conversion node. This is expected behavior.
That said, the export should not result in a deformed character. It looks like we still have some issues in the exporter when exporting skins / skeletons from LH to RH. Maybe @alexchuber will have time to look into this.
In the meantime, if you are able to use a right-handed scene (e.g., scene.useRightHandedSystem = true), a lot of these problems will go away since there is no handedness conversion needed to export to glTF: https://playground.babylonjs.com/#YCY2IL#2500