Search the Community
Showing results for tags 'babylon.sceneloader.load'.
-
Hello everybody, I created a very simple scene (1 simple sphere) with Clara.io, then exported it in .babylon format. This file is named "scene2.babylon" In my folder named "babylontest", I have 2 files : - scene2.babylon - babylon.html (code below) Would anyone know why the code below doesn't work (nothing appears when I load "babylon.html")? Is there a problem with the line "BABYLON.SceneLoader.Load("", "scene2.babylon", engine, function (newScene)" ? Thank you in advance if you can help !!! Cheers, Chris ------------------ <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using babylon.js - How to load a scene</title> <script src="https://cdn.babylonjs.com/babylon.max.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("", "scene2.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> babylon.html