reggie Posted September 3, 2018 Share Posted September 3, 2018 Hi guys,I have created a simple cube in blender and am trying to import it in babylon js.The scene is not coming and the error i am getting is this BJS - [14:10:21]: Unable to import meshes from miningtesting123.babylon: Failed to load scene. The code I am using is BABYLON.SceneLoader.ImportMesh("","","miningtesting123.babylon", scene,function(newMeshes) I have ran my .babylon file in sandbox and the model is coming there. Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted September 3, 2018 Share Posted September 3, 2018 We will need more details here. The code you've paste here seems incomplete. You can start by simplifying your ImportMesh function (like in this playground example), and also check if your browser console show errors. If your .babylon is online, you can try to use it in the playground (check https/http to avoid errors). Quote Link to comment Share on other sites More sharing options...
reggie Posted September 3, 2018 Author Share Posted September 3, 2018 I am attaching the full code that I am using.Please tell me where I am wrong. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Page Title</title> <script src="https://cdn.babylonjs.com/babylon.max.js"></script> </head> <body> <canvas id="canvas"></canvas> <script> window.addEventListener('DOMContentLoaded', function(){ var canvas = document.getElementById('canvas'); var engine = new BABYLON.Engine(canvas, true); engine.enableOfflineSupport = false; // Dont require a manifest file var createScene = function(){ var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3.White(); var camera = new BABYLON.ArcRotateCamera("arcCam", BABYLON.Tools.ToRadians(0), BABYLON.Tools.ToRadians(0), 10.0,BABYLON.Vector3.Zero(),scene); camera.attachControl(canvas,true); var light = new BABYLON.PointLight("PointLight",new BABYLON.Vector3( 0,0,0),scene); light.parent = camera; light.intensity = 1.5; BABYLON.SceneLoader.ImportMesh("","","miningtesting123.babylon", scene,function(newMeshes) { newMeshes.forEach(function(mesh){ mesh.rotation = new BABYLON.Vector3(BABYLON.Tools.ToRadians( 45),0,0); } ); }); return scene; } var scene = createScene(); engine.runRenderLoop(function(){ scene.render(); }); }); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted September 3, 2018 Share Posted September 3, 2018 I'm not sure, but because you use babylon.max.js, maybe loaders are missing. Here the source of playground for example: Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted September 3, 2018 Share Posted September 3, 2018 But what say your browser console? Quote Link to comment Share on other sites More sharing options...
reggie Posted September 4, 2018 Author Share Posted September 4, 2018 Hi @V!nc3r I have solved the issue by running it in local server.Thanks for your time Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.