How to load local glb files into Babylon Native

here is the implementation i used

var modelUrls = ["../../8c425d/AstoCT_01.glb", "../../8c425d/AstoCT_02.glb", "../../8c425d/AstoCT_03.glb","../../8c425d/AstoCT_04.glb"];
function CreateSceneMeshes(scene) {
    modelUrls.forEach((e,i) => {
       BABYLON.SceneLoader.AppendAsync(modelUrls[i]).then(function () {
            BABYLON.Tools.Log(scene.meshes);
        });
    })
    return Promise.resolve();
}

var engine = new BABYLON.NativeEngine();
var scene = new BABYLON.Scene(engine);

CreateSceneMeshes(scene).then(function () {
    scene.createDefaultCamera(true, true, true);
    scene.activeCamera.alpha += Math.PI;

    if (ibl) {
        scene.createDefaultEnvironment({ createGround: false, createSkybox: false });
    }
    else {
        scene.createDefaultLight(true);
    }

}, function (ex) {
    console.log(ex.message, ex.stack);
});

1 Like

Cc @BabylonNative

Hey @sai_chaitanya , how are you doing?

You should be able to reference local GLB files by using “app:///” in the path. This will be relative to the localtion of the executable running Babylon Native.

For example, if your AstoCT_01.glb is in your application’s folder you should use:

BABYLON.SceneLoader.AppendAsync("app:///AstoCT_01.glb")
1 Like

Hello @sai_chaitanya do you have any more questions about this?

thanks very much, i spent hours trying to figure out how to load files, this should be mentioned in the README