OnStepObservable Frequency

Hey all! I am trying to find a way to increase the Frequency of OnStepObservable. Specifically, I am using a deterministic physics engine, but I am trying to increase the accuracy, not only of the physics loop internally, but since I have some custom code, that should run more frequent as well.

In a simple example, please see https://www.babylonjs-playground.com/#DU4FPJ#186 . The box on the left should rotate faster if the frequency increases, but no matter what I do, it rotates at the same speed.

Essentially what I’d like is a deterministic function such as onStepObservable (OnPhysicsObservable tends to give different results depending on the framerate/machine?), but with a higher frequency than 1/60. Hopefully I am just missing something obvious :smiley:

Adding @RaananW

Thanks @Deltakosh !

I realized… I had to set this when creating the engine! I was missing something obvious :smiley:

engine = new BABYLON.Engine(canvas, true, {
    deterministicLockstep: true,
    lockstepMaxSteps: 40,
    timeStep: 1/600
});
1 Like

All good:)