Search the Community
Showing results for tags 'importmesh loader babylon'.
-
Hi: I am trying to import mesh using BABYLON.SceneLoader.ImportMesh. there doesn't seem to be any error with the code but the mesh is not loading anf the loader gui lasts forever. I inspect the elements with google crome and it says that cannot find the objects. the assets folder is within the html folder project and the skull.babylon is there so there is nothing wrong (I followed the video tutorial by David, he got it right but I got it wrong ). any help? <!DOCTYPE html> <html> <head> <title>babylon</title> <meta charset="utf-8" /> <script src="javascript/babylon.2.5.js"></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var Canvas = document.getElementById("renderCanvas"); var Engine = new BABYLON.Engine(Canvas, true); var Scene = MakeScene(); Engine.runRenderLoop(function () { Scene.render(); }) window.addEventListener("resize", function () { Engine.resize(); }) function MakeScene() { var scene = new BABYLON.Scene(Engine); scene.clearColor = new BABYLON.Color3(125 / 255.0, 0, 0); var hLight = new BABYLON.HemisphericLight("hLight", new BABYLON.Vector3(0, 1, 0), scene); var aCam = new BABYLON.ArcRotateCamera("aCam", 2 * Math.PI / 3, Math.PI / 3, 30,BABYLON.Vector3.Zero(), scene); aCam.attachControl(Canvas, false); Engine.displayLoadingUI(); //PROBLEM IN HERE, google crome says can'T FIND FOLDER, AND OBJECT SKULL.BABYLON //the folder (asset)and the file are inside the project directory //no comment on error in microsoft edge. BABYLON.SceneLoader.ImportMesh("test", "assets/", "skull.babylon", scene, function (newMeshes) { camera.target = newMeshes[0]; engine.hideLoadingUI(); }); var mGreen = new BABYLON.StandardMaterial("mGreen", scene); mGreen.diffuseColor = BABYLON.Color3.Green(); var obj = BABYLON.Mesh.CreateBox("box", 5, scene); obj.material = mGreen; return scene; } </script> </body> </html> assets.zip