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
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 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;
/#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
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.