Unexpected Mesh Transformations on GLB Export

Hello !

I’m trying to export my .babylon project as a .GLB file, but when I click on “Export to GLB”, either using the Inspector or the GLTF2Export class, some of the meshes move unexpectedly. I don’t understand why this is happening, and I’m not sure if it’s a bug or if I’m doing something wrong.

Playground with my .babylon project here : https://playground.babylonjs.com/#OVGL4F#5

PS: Use the "camera1" in the Inspector, as the default camera doesn’t work properly
.
Edit: Sorry, I forgot to mention an important detail : Even when I open the exported .GLB file in the Babylon.js Sandbox, the meshes are still incorrectly positioned.

Thanks in advance !

Max

It’s indeed quite weird, I think there is an issue due to parenting. Also a new export is putting back the meshes at the right place :thinking: Let’s wait for the official devs to see this.


It’s because the new camera added from the import is set as active camera.
So, in the callback function of the scene load (which is empty here), either you can do :

scene.activeCamera = camera; // Putting back the old one as active

or

scene.getCameraByName("free camera").attachControl(canvas, true); // Attaching control to the new one

Also, please note that you don’t need this :

var canvas = document.getElementById("renderCanvas");

Since it’s defined already in the context

1 Like

Let me add @alexchuber who should be able to help finding the culprit :slight_smile:

This fixes the unexpected rotation on export: glTF Exporter: Don't modify original quaternion reference! by alexchuber · Pull Request #16858 · BabylonJS/Babylon.js · GitHub

The meshes still being out-of-place in the generated file is a separate issue. I suspect it’s the pivots in some of the meshes, which are not supported in the glTF exporter:

1 Like