How can i load .glb file from github repo

Hello i’m trying to load my glb file to the scene but wasnt able to.
I am using this code

BABYLON.SceneLoader.Append("https://github.com/unholy182000/Assets/tree/master/meshes", "0Mercedes6_kucuk.glb", scene, function (scene) {

    // do something with the scene

});

but it dosent loads. Very new to the babylon sorry for inconvinience

Try to use https://github.com/unholy182000/Assets/tree/master/meshes/ => notice the closing / at the end of the string.

no change doesn’t load

I think you will need to provide a repro in https://playground.babylonjs.com/ so that we can have a look.

i cant load from Assets/meshes at master · BabylonJS/Assets · GitHub either.

In examples section in the website there is an example named Load .gltf model.
When i open it in playbox code is this

var delayCreateScene = function () {

var scene = new BABYLON.Scene(engine);

// The first parameter can be used to specify which mesh to import. Here we import all meshes

BABYLON.SceneLoader.Append("https://models.babylonjs.com/", "alien.glb", scene, function (newMeshes) {

    scene.createDefaultCameraOrLight(true);

    scene.activeCamera.attachControl(canvas, false);

    scene.activeCamera.alpha += Math.PI; // camera +180°

});

return scene;

}

When i go to the adress https://models.babylonjs.com/ it says use github.

When i change code to this it doesnt loads anything

var delayCreateScene = function () {

var scene = new BABYLON.Scene(engine);

// The first parameter can be used to specify which mesh to import. Here we import all meshes

BABYLON.SceneLoader.Append("https://github.com/BabylonJS/Assets/tree/master/meshes/", "alien.glb", scene, function (newMeshes) {

    scene.createDefaultCameraOrLight(true);

    scene.activeCamera.attachControl(canvas, false);

    scene.activeCamera.alpha += Math.PI; // camera +180°

});

return scene;

}

The alien.glb file is in the Alien/ subdirectory:

However, there’s a CORS security problem:

/#JEMSE9:1 Access to XMLHttpRequest at 'https://github.com/BabylonJS/Assets/tree/master/meshes/Alien/alien.glb' from origin 'https://playground.babylonjs.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://github.com/BabylonJS/Assets/tree/master/meshes/Alien/alien.glb net::ERR_FAILED

I think this one is for @RaananW or @Deltakosh

no alien.glb is in meshes file.
in meshes/Alien/ subdirectory there is Alien.gltf file

Ah, my bad! But the problem is still a CORS problem.

You must load from github raw :slight_smile:
Primary github domain doesn’t allow CORS

Thanks @aWeirdo, so the corrected PG is:

https://playground.babylonjs.com/#JEMSE9#1

And the right link is: https://raw.githubusercontent.com/BabylonJS/Assets/master/meshes/

The assets library is available at https://assets.babylonjs.com/ . You can use it instead of githubraw. The repo directory is structure is available there entirely.