wind Posted March 23, 2016 Share Posted March 23, 2016 I follow a Microsoft tutorial to show a scene that I exported from 3ds Max. The tutorial link is: https://blogs.msdn.microsoft.com/eternalcoding/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender/ The Babylon scene can be seen on the Sandbox, but not offline. Here is my page code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Using babylon.js - How to load a scene</title> <script src="babylon.js"></script> <script src="hand.js"></script> <script src="cannon.js"></script> <!-- optional physics engine --> <script src="oimo.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("", "TestExportFrom3dsMax.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> How to show the Babylon scene on web browser offline? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 23, 2016 Share Posted March 23, 2016 Hello Wind, due to security restrictions, you need to host your file (including the .babylon) in a web server (even locally for offline consumption) Depending on your OS you can use WAMP, IIS, Apache, etc... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 24, 2016 Share Posted March 24, 2016 Hi Wind, Hi Deltakosh. Yeah, when "they" changed the XmlHttpRequest (XHR) object in browsers worldwide, they took away some of our fun, didn't they? Them danged "theys"... I never really liked those people. Some hacker used XHR to sneak past some barrier, and then suddenly, XHR lost much of its power. hrmph! Who can we complain-to? The W3C? Rumor has it... the changes are for OUR protection... but I want to see proof. heh. Quote Link to comment Share on other sites More sharing options...
wind Posted March 24, 2016 Author Share Posted March 24, 2016 @Deltakosh , thanks, it works 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.