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.
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.
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 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");
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: