FreeCamera doesn't work properly with deterministicLockstep in Playground

I still can rotate camera but movements with arrow keys don’t work.
When not in the playground it works okay, but I am using relatively old version locally. So, it might be not relevant.

Here is example from doc: Doc link. FreeCamera in the playground example doesn’t work.

@PolygonalSun, could this be a regression ?

It was already the case in 4.2 but it seems strange indeed :frowning: maybe @Cedric or @RaananW would know as well ?

Based on what I’m seeing, it looks like the value for engine._deltaTime is getting stuck at 0 so whenever the speed for keyboard movement is calculated, it ends up being 0 and no movement is made. I’m not sure why this is happening yet but something isn’t letting that value get updated to a non-zero value.

Maybe @Cedric can provide us tips on how what value to use in deterministic lock step mode ?

No particular tips here but figuring out why deltaTime is 0.

2 Likes

Thanks man, for the time being I’m going to assign this to you while you investigate this and when you find something, just assign it back to me.

I can’t repro on my side. I’ve added

deterministicLockstep: true,
  lockstepMaxSteps: 4,

in the options at engine creation but the freecamera is still working with arrow keys.
How did you repro @PolygonalSun ?

I just repro’d it by trying out the PG at the end of the deterministic lockstep section linked above: Deterministic lockstep sample | Babylon.js Playground (babylonjs.com)

2 Likes

render loop is not running on the new engine created in the PG. So, no beginFrame called and the deltaTime is not computed.
adding

engine.runRenderLoop(function(){
    scene.render();
});

will trigger the _deltaTime computation and arrow keys will work.

3 Likes

Makes sense. Thus, it’s a documentation issue, not the BabylonJS issue itself. Thank you.

1 Like