Volcanic.Phoenix Posted February 26, 2014 Share Posted February 26, 2014 Hi all, Im so beginner with babylon.js and im trying to do a simple example to view .babylone file with a code that i found in some sites,but it didnt work with me.i tryed to view the Windows cafe example (wcafe.babylon) founded in sence folder with this code that i placed in the same folder with babylon.1.9.0.js file<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> <title>Using babylon.js - How to load a scene</title> <script src="babylon.1.9.0.js"></script> <style> html, body { width: 100%; height: 100%; padding: 0; margin: 0; overflow: hidden; } #renderCanvas { width: 100%; height: 100%; } </style></head><body> <canvas id="renderCanvas"></canvas> <script> if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "WCafe.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); }</script> </body></html>So, is there anything to do with the "wcafe.babylon" file or the problem is from code?PS: i use apache server to test itand sorry for my Englesh Quote Link to comment Share on other sites More sharing options...
Temechon Posted February 26, 2014 Share Posted February 26, 2014 Hello, welcome on this forum ! Which browser are you using ? Do you have anything written in the javascript console ? Did you copied all textures of the wcafe scene in the same folder that your wcafe.babylon ? Anyway, your code seems correct to me... Maybe an explicit javascript error in the console will help us Quote Link to comment Share on other sites More sharing options...
gwenael Posted February 26, 2014 Share Posted February 26, 2014 Did you place WCafe.babylon and the rest of the assets for this demo to the same folder as babylon.1.9.0.js like you did for your index.html? You can set the first parameter of BABYLON.SceneLoader.Load to the rootUrl of the folder containing WCafe.babylon. If you are on Windows and have Visual Studio 2010, you can use Tools\BuildOurOwnBabylonJS\BuildOurOwnBabylonJS.sln which will set everything for you. More about it here: https://github.com/BabylonJS/Babylon.js/tree/master/Tools/BuildOurOwnBabylonJS Quote Link to comment Share on other sites More sharing options...
gwenael Posted February 26, 2014 Share Posted February 26, 2014 Welcome on board by the way Volcanic.Phoenix 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted February 26, 2014 Share Posted February 26, 2014 Funnily enough, I tried the same thing today and it did not work either. I got the "LoadScene" code from here including the .babylon.js file: How to load a .babylon file produced with Blender The file size of babylon.js is 187kb - it seems to be an old version. I found a newer version with a file size of 310kb - and it seems to work fine. You probably need to get the latest version of that file. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Volcanic.Phoenix Posted February 28, 2014 Author Share Posted February 28, 2014 I use firefox 27.0.1 and putted all files (index.html, babylon.1.9.0.js) in the same folder with the .babylon file and the texture. PS: babylon.1.9.0.js is the latest version i found (395 KB) useing apache the example "How to load a .babylon file produced with Blender" works (but without the ball) with the 187kb version, but didnt work with 395kb version (babylon.1.9.0.js) and it give me this error: ("BABYLON.Vector3.FromArray@http://localhost/babylonjs-how-load-babylon/babylon.js:1parseLight@http://localhost/babylonjs-how-load-babylon/babylon.js:22loadSceneFromData@http://localhost/babylonjs-how-load-babylon/babylon.js:22BABYLON.Tools.LoadFile/noIndexedDB/request.onreadystatechange@http://localhost/babylonjs-how-load-babylon/babylon.js:1") it's look like I must use another way to view the .babylon file, but i dont know how :/ 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.