hunts Posted March 23, 2017 Share Posted March 23, 2017 Hello, i've been trying to load a scene from my github, but it doesn't load anything <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon.js sample code</title> <!-- Babylon.js --> <script src="http://www.babylonjs.com/hand.minified-1.2.js"></script> <script src="http://www.babylonjs.com/cannon.js"></script> <script src="http://www.babylonjs.com/oimo.js"></script> <script src="http://www.babylonjs.com/babylon.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> <div id="canvasZone"> <canvas id="renderCanvas"></canvas> </div> <script> var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("https://raw.githubusercontent.com/BabylonJS/Website/master/Scenes/Sponza/", "Sponza.babylon", engine, function (scene) { // Wait for textures and shaders to be ready scene.executeWhenReady(function () { scene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 0.3, scene); // Move the sphere upward 1/2 its height sphere.position.y = 1; scene.onPointerDown = function (evt, pickResult) { console.log(pickResult); if(pickResult.hit){ // if the click hits the ground object, we change the impact position if (pickResult.pickedMesh.name = "sphere1") { sphere.dispose() } } }; engine.runRenderLoop(function() { sphere.position.z -= 0.002; scene.render(); }); }); }, function (progress) { // To do: give progress feedback to user }); } engine.runRenderLoop(function () { scene.render(); }); // Resize window.addEventListener("resize", function () { engine.resize(); }); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
adam Posted March 23, 2017 Share Posted March 23, 2017 You need a camera. http://doc.babylonjs.com/tutorials/creating_a_basic_scene Quote Link to comment Share on other sites More sharing options...
hunts Posted March 23, 2017 Author Share Posted March 23, 2017 @adam it works without the camera on the PG, but when i download the scene as a zip file, it doesn't show anthing,, importMesh seems to work fine Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 23, 2017 Share Posted March 23, 2017 What does your console say? There is no such thing as " doesn't load anything". This is programming. You can also turn on additional logging for sceneloader by placing this before the load statement, should the console does not show you your issue: BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING; GameMonetize 1 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.