Load Upload GLB file in Scene not work

Hello,

i try upload a file and load it directly in scene. But i get this error see screenshot.

Load this file in Sandbox works fine. What is wrong here?

After Upload is finished i put “data:application/octet-stream;base64” into SceneLoader.

   if (["loadend", "load"].includes(event.type)) {
        console.log("finished loading file");
        currentProgress.value = "Finished loading file";
        fileUrl.value = reader.result;

        BABYLON.SceneLoader.Append(
          "",
          fileUrl.value,
          globalSceneRef.value,
          function () {
            globalSceneRef.value.createDefaultCamera(true, true, true);
          }
        );
      }

It is really hard to tell without a repro. Could you create one in the playground ?

1 Like

@rbrose,

Sebavan has a good point with the repro, though as a best practice if your loading from a model file you should use glTF and then do something like this for loading:

BABYLON.SceneLoader.Append("", "data":+gltfString, scene, ()=>{
    globalSceneRef.value.createDefaultCamera(true, true, true);
}, 0, 0, ".gltf");

where gltfString is the contents of our glTF file - this also allows us to do

new Blob([fileContents]).text().then(data=>{
    //SceneLoader Here
});

This might clear up your problems by using glTF. I also noticed that the error refers to data:data:... so maybe check their isn’t something like "data:"+dataString where dataString also has data: