Zino54220 Posted April 7, 2015 Share Posted April 7, 2015 Hi everyone! (for the third time today!) I have a little problem with my game... I see that the scene have a function : "scene.executeWhenReady" very good but in my case, I importe skeletons after the scene loading so I get this result : You can see after the scene loading (after many seconds...) that the skeletons appears after and after again another meshes...So my question :There is a way to make during the loader script until all the components as scene, meshes, cameras, etc... are loaded? Thanks ! Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 7, 2015 Share Posted April 7, 2015 Hi Zino, scene.executeWhenReady is the function you are looking for.The function onSuccess of the loader is not the same. In your case, you should put scene.executeWhenReady in the onSuccess of the loader, and create the engine render loop in executeWhenReady. Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted April 7, 2015 Author Share Posted April 7, 2015 Thans Temechon! I will try and come back to you soon. Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted April 7, 2015 Author Share Posted April 7, 2015 So, I tried this but same result :function runStadeOfficiel(canvasId) { var canvas = document.getElementById(canvasId); var engine = new BABYLON.Engine(canvas, true); scene = new BABYLON.Scene(engine); // Wait for textures and shaders to be ready scene.executeWhenReady(function () { BABYLON.SceneLoader.Load("", "stadeOfficiel.babylon", engine, function (newScene) { scene = newScene; createRobot(scene,robotUser); // here I create the character with skeleton and meshes createControlsRobot(scene,robotUser); // here I create the control key of user for the character // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { scene.render(); }); }); }); }My original algo is here :function runStadeOfficiel(canvasId) { var canvas = document.getElementById(canvasId); var engine = new BABYLON.Engine(canvas, true); scene = new BABYLON.Scene( BABYLON.SceneLoader.Load("", "stadeOfficiel.babylon", engine, function (newScene) { scene = newScene; createRobot(scene,robotUser); createControlsRobot(scene,robotUser); // Wait for textures and shaders to be ready scene.executeWhenReady(function () { // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { scene.render(); }); }); }); }What's I'm doing wrong? Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 7, 2015 Share Posted April 7, 2015 Your second snippet is good, the first one is not. I don't know, i cannot see any 'isReady' method on skeletons... Quote Link to comment Share on other sites More sharing options...
Zino54220 Posted April 9, 2015 Author Share Posted April 9, 2015 Yeah but the second snippet is my first algorithm and I always had this problem... Can I made an homemade function to make this? 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.