2

I want to know how can I load two or more babylon files in one html page or if its possible to join them. I have the following code which its good to see one simple model (exported) but I need add more exported models in the same html page. I heard about a "options.babylonFolder + "/", options.babylonFile" option but I dont know more than that.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using babylon.js - How to load a scene</title>
<script type="text/javascript" src="./103A_files/hand.js"></script>
<script type="text/javascript" src="./103A_files/cannon.js"></script>
<script type="text/javascript" src="./103A_files/babylon.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("", "101A.babylon", engine, function (newScene) {
          //BABYLON.SceneLoader.Load(options.babylonFolder + "./GrupoBabylon", options.babylonFile, engine, function (newScene) {  
            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>

4

1 回答 1

2

You can use BABYLON.SceneLoader.Append to merge a new scene with the current one

于 2014-12-23T21:15:23.727 回答