Herbert Posted October 20, 2017 Share Posted October 20, 2017 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() 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? Quote Link to comment Share on other sites More sharing options...
RNull Posted October 20, 2017 Share Posted October 20, 2017 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() 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. Quote Link to comment Share on other sites More sharing options...
Herbert Posted October 21, 2017 Author Share Posted October 21, 2017 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) Quote Link to comment Share on other sites More sharing options...
Herbert Posted October 22, 2017 Author Share Posted October 22, 2017 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) Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 23, 2017 Share Posted October 23, 2017 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. Quote Link to comment Share on other sites More sharing options...
Herbert Posted October 25, 2017 Author Share Posted October 25, 2017 I thought max version refers to latest version 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); 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.