Jump to content

Error when I set Engine => lockstepMaxSteps higher than 1


Herbert
 Share

Recommended Posts

hi 
I try to use onBeforeStepObservable so I pass two more option to engine(http://doc.babylonjs.com/tutorials/animations#deterministic-lockstep)

var engine = new BABYLON.Engine(canvas, true, {
    deterministicLockstep: true,
    lockstepMaxSteps: 4
});

and it occurs an error like below at scene.render()

error.png.dc45a922f11c96cd47634b6bb83cdd75.png

engine.runRenderLoop(() => {
    scene.render();
});

If I set the lockstepMaxSteps to 1, then it's alright.
This issue seems not happen to the example on PG(https://www.babylonjs-playground.com/#DU4FPJ#3)

any hint what could be the problem?

Link to comment
Share on other sites

9 hours ago, Herbert said:

hi 
I try to use onBeforeStepObservable so I pass two more option to engine(http://doc.babylonjs.com/tutorials/animations#deterministic-lockstep)


var engine = new BABYLON.Engine(canvas, true, {
    deterministicLockstep: true,
    lockstepMaxSteps: 4
});

and it occurs an error like below at scene.render()

error.png.dc45a922f11c96cd47634b6bb83cdd75.png


engine.runRenderLoop(() => {
    scene.render();
});

If I set the lockstepMaxSteps to 1, then it's alright.
This issue seems not happen to the example on PG(https://www.babylonjs-playground.com/#DU4FPJ#3)

any hint what could be the problem?

Hey @Herbert ,

Can you try with max version ? It should give a better insight. I will however try it later and post here the results.

Link to comment
Share on other sites

Hi @RelativeNull
This is already tested in the latest version(3.1 alpha)
I recreate a simple project and everything goes well, so I think it only happens to a specific case.
I will test around it, if I find something I will post it here.

but i am also curios  why does the speed become so slow in this PG example(https://www.babylonjs-playground.com/#DU4FPJ#3)

Link to comment
Share on other sites

So it might happen when I try to switch the scene to be rendered.

var scene = createScene(engine);
var scene2 = createScene(engine);

var sceneOption = [
    scene,
    scene2
];

var sceneIndex = 0;

setTimeout(() => {
    sceneIndex = 1;
}, 0);

engine.runRenderLoop(function () {
    sceneOption[sceneIndex].render();
});

and it depends on the timing you switch the scene(e.g. maybe switch at 10ms is alright, but might go wrong at 11ms)

Link to comment
Share on other sites

First about the speed - it seems like the cannon step time is wrong. Issue already exists in GitHub, I am taking care of this today.

About the scene switching - Maybe make sure to switch scenes right before the runder loop starts, so you will be surer there is no leak between the two. Scene-switching should be working and shouldn't be a problem. Make sure you initialize your meshes in the right scene, and that the render loop starts and ends with the same scene (should be the case, unless you do async stuff internally).

If you can reproduce it (playground or online), it would be wonderful to see what the problem is. And as @RelativeNull said, a babylon.max would be helpful for debugging.

Link to comment
Share on other sites

I thought max version refers to latest version:wacko:

ok, I will try babylon.max.

and I will try to reproduce it on PG, just wonder how I can switch scene on PG(since runRenderLoop is called outside)?

"the render loop starts and ends with the same scene" => does that mean I have to call stopRenderLoop before I switch scene and start a new loop?
 

var scene = createScene(engine);
var scene2 = createScene(engine);

var renderLoop = engine.runRenderLoop(function () {
    scene.render();
});

setTimeout(function() {
    engine.stopRenderLoop(renderLoop);

    engine.runRenderLoop(function () {
        scene2.render();
    });
}, 2000);

 

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