Vijay Kumar Posted January 1, 2016 Share Posted January 1, 2016 Hi,My name is vijay.I am new to this forum and new to Babylonjs.i got very much existed by the wonders we can create by using babylonjs so i started working on it.Especially in this forum people were very kind and good in helping others.My Issue is: we can assign a babylon scene to a scene variableex: var createScene = function(){ // create a basic BJS Scene object var scene = new BABYLON.Scene(engine); ........... // return the created scene return scene; } // call the createScene function var scene = createScene(); But how can we assign a scene loaded from other exporters like unity to a variable scene.The below is working perfectly but i want to assign the newscene to a variable scene like above.so that i can use scene in globally also. BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) newScene.executeWhenReady(function () { newScene.activeCamera.attachControl(canvas); engine.runRenderLoop(function() { newScene.render(); }); }); } please help me and sry for my english. Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 2, 2016 Share Posted January 2, 2016 Hello, Maybe this can help you : https://github.com/Temechon/Dungeon/blob/master/Dungeon.js#L12 Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted January 2, 2016 Author Share Posted January 2, 2016 Hi Temechon, Thanks for the help.could you plz help me with a simple example .the reference file you provided is very big and i couldn't understand it.Thanks,Vijay Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 2, 2016 Share Posted January 2, 2016 Here is simple example: var gameScene= null;BABYLON.SceneLoader.Load("assets/", "dungeon.babylon", engine, function(scene) { gameScene = scene; initGame(); gameScene.executeWhenReady(function() { engine.runRenderLoop(function () { gameScene .render(); }); });});function initGame() { // use gameScene here} Quote Link to comment Share on other sites More sharing options...
Vijay Kumar Posted January 11, 2016 Author Share Posted January 11, 2016 Thanks Temechon. 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.