Models not keeping transformation after export

So I’m working on a project were users can upload basically any gltf model and my scene will center it and scale it to a specific position and scale for later use.

The transforms (scale, position) work perfectly in my scene, but when I export it using Babylon glb exporter, when I load the saved glb back in a scene the models do not keep the transforms from my export scene.

heres a playground

i seem to have more then one problem, from a handful of models iv tested, they centered and scaled perfectly, but now after making a test via playground iv noticed its not working 100% of the time, its is noticeable if you switch the model in the playground to toast or ufo?

You can use the option includeCoordinateSystemConversionNodes set to true on GLBAsync, to keep root transformation, see docs:

These are the nodes in your playground:


And here the nodes of exported glb in sandbox:


So I did also exclude camera, backgroundhelper and mbox from Export, but you rather decide yourself what you need.



awesome that kinda/basically worked, thanks

unfortunately flicking through some of the other models, some seem to end up all deformed?, do you know if this a bug?

also as iv mentioned some models dont seem to center correctly, i know this is off scope of this question, not sure if i should create a new question for this? far as im aware im grabbing max/min for bounding box (which should be around instanced mesh?, assuming pivot point shoulding matter then?), so im not sure why the bounding box is centered but not the mesh?

unfortunately flicking through some of the other models, some seem to end up all deformed?, do you know if this a bug?

It seems to me that the change of position conflicts with your animation (position keys don’t change). What works is to change the child node of your root:

scene.getTransformNodeByName('RootNode.0').position = new BABYLON.Vector3(centX, centY, centZ);


this kinda gets me 90% of the way there, my only problem is users can upload their own model so im not sure how i can retrieve the root node by ‘name’ for unknown models?

double checking there also, this doesnt seem to keep transforms?, if you try the alien and then the heart you can see the heart is much smaller after export?

i think iv solved getting the node name dynamically using this

var rootNode = meshes[0]._children[0].name

im not 100% sure how reliable this is though not knowing the model beforehand, im guessing models are always imported with meshes[0] - root - children[0] - transformnodename?

but still this isnt solving my original question as transforms are still not properly saved after export from what i can see?, unless im seeing it wrong?

it looks like the models are just exporting with their original scale/position before i try to apply any transforms?, should the exporter not just export what you see in the scene?

Maybe you can test out this, it works for me in playground and sandbox:

I added scene.useRightHandedSystem = true (gITF-specifications) and accounted in negative scaling.


dont want to count my chickens too soon, but iv tested loading the exports into another scene in BJS and Aframe and so far the seem to be working perfectly now.

thanks a million for your help, feel like i owe you a beer or something :joy:

so for now i will mark this solved!

again, thankyou @Takemura

1 Like

just on a side note, when viewing the exported models in windows ‘3dviewer’ the models seem to be different scales, but as they load fine on the web i wont be digging any deeper :joy: