Jump to content

Make during the presentation function?


Zino54220
 Share

Recommended Posts

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 :

 

 

post-6162-0-11234600-1428409951.gif

 

 

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  :) !

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

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...