Jump to content

Exception issue loading Babylon scene file


chicagobob123
 Share

Recommended Posts

I am loading a scene exported from 3DS and it will load in the 

http://sandbox.babylonjs.com/

But in code it fails on this line as parsedData.cameras is undefined. 

 for (index = 0, cache = parsedData.cameras.length; index < cache; index++) 

Is this because there are no cameras in the Babylon  scene file and if so should

that matter because I created a camera for the scene

 

 

 

Link to comment
Share on other sites

I probably screwed up.  (More background) At first was getting a 404 for a .manifest file.  I created the a file and named it .manifest 

<!DOCTYPE html>
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Measurement</title>
  <style>
html, body {
    height: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: fixed;
}
#renderCanvas {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
  </style>
 </head>
 <body>

  <canvas id="renderCanvas"></canvas>

  <div id="MessageDisplay" style="position: absolute; top: 50px; left: 200px;  background-color: black; opacity: 0.8; color:white; touch-action:none;"></div>

  <script src="babylon.max.js"></script>


  <script>

  var sps;
  var Tail=1;
  var nb = 50000;              // particle number
  function writeToScreen(message)
   {
    var pre=document.getElementById("MessageDisplay");
    pre.style.wordWrap="break-word";
    pre.innerHTML=message;
   }

  window.addEventListener('DOMContentLoaded',function()
   {
    var canvas = document.getElementById('renderCanvas');
    var engine=new BABYLON.Engine(canvas,true);
    sleepFor=function(sleepDuration)
     {
      var now = new Date().getTime();
      while(new Date().getTime()<now+sleepDuration)
        { /* do nothing */ }
      }


  var createScene=function()
   {

    BABYLON.Engine.enableOfflineSupport = false;
    var scene = new BABYLON.Scene(engine);
    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
    var camera = new BABYLON.ArcRotateCamera("camera1",  0, 0, 0, new BABYLON.Vector3(0, 0, -0), scene);
    camera.setPosition(new BABYLON.Vector3(0, 0, -150));

    BABYLON.SceneLoader.Append("models/", "YardTile001.babylon", scene);
     

    
    scene.registerBeforeRender(function() {    
    light.position = camera.position;
    });

  // the canvas/window resize event handler
  window.addEventListener('resize', function(){
      engine.resize();
  });


    return scene;
   }

  // call the createScene function
  var scene=createScene();

 

  function onMessage(evt) {
     
  }

  scene.executeWhenReady(function () {
    // Attach camera to canvas inputs
    scene.activeCamera.attachControl(canvas);

    // Once the scene is loaded, register a render loop
    engine.runRenderLoop(function() {
       scene.render();
    });

   });


   });

  </script>

 </body>
</html>

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...