Trying to use a DracoDecode

Hi, everyone. I usually create my scene by using the blender editor and exporting it to the babylon frame on the babylon editor. Recently we noticed that the scene.babylon archive is too heavy and we decided to try importing the .glb file direct to the scene script. I tried many ways to solve the problem but it doesn’t work, and my screen only displays a white background and no console problem. I was hoping you guys could help me.

The rest of the code is fine, defining the camera, gui config and all this stuff. My problem is here on these particular lines.

  // import scene

BABYLON.SceneLoader.ShowLoadingScreen = false;
BABYLON.Tools.LoadFile(“auditoriotodraco.glb”, onSceneImported, onLoading);

function onLoading(evt) {
// onProgress
var loadedPercent = 0;
if (evt.lengthComputable) {
loadedPercent = (evt.loaded * 100 / evt.total).toFixed();
} else {
var dlCount = evt.loaded / (1024 * 1024);
loadedPercent = Math.floor(dlCount * 100.0) / 100.0;
}
// assuming “loadingScreenPercent” is an existing html element
document.getElementById(“loadingScreenPercent”).innerHTML = loadedPercent + “%”;
}
function onSceneImported(newMeshes, particleSystems, skeletons) {
async function draco(data){
var dracoCompression = new BABYLON.DracoCompression();
var attributes = {
// [BABYLON.VertexBuffer.UVKind]: 0,
// [BABYLON.VertexBuffer.NormalKind]: 1,
// [BABYLON.VertexBuffer.TangentKind]: 2,
[BABYLON.VertexBuffer.PositionKind]: 3
};
var vertexData = await dracoCompression.decodeMeshAsync(data, attributes);
var mesh = new BABYLON.Mesh(“dracoMesh”, scene);
var geometry = new BABYLON.Geometry(“dracoGeometry”, scene, vertexData, undefined, mesh);
return draco
}
const modalOverlay = document.querySelector(’.modal-overlay’);
scene.activeCamera = camera;
scene.gravity = new BABYLON.Vector3(0, -0.1, 0);
var camSphere = BABYLON.MeshBuilder.CreateSphere(“sphere”, {diameterY: 3, diameterX: 0.1}, scene);
camSphere.parent = camera;
camSphere.visibility = 0;
scene.registerBeforeRender();

/* Make performance better */
scene.autoClear = false;
scene.autoClearDepthAndStencil = false;
scene.blockMaterialDirtyMechanism = true;
scene.getAnimationRatio();

setTimeout(function(){
  engine.hideLoadingUI();
    modalOverlay.classList.add("active");
}, 5000);

}

return scene
}

Why don’t you import the .glb as any other file? For eg:

https://playground.babylonjs.com/#SYQW69

That helped me a lot. But one more question, I need the collisions checked on the scene, so my camera can walk. In the past, I did it by the babylon editor and just exported it to a scene.babylon file. Is there any way of doing that without “much code” ( I mean without writing check collision to each mesh I import)

There are a number of docs in the doc repo, for eg:

Look for “collision” in https://doc.babylonjs.com/, other links will show up.

thanks i will take a closer look.