How to make Havok physics simulation faster

I am using Havok for physics and i want to simulate objects movement in miliseconds. I mean i need to fast forward time. This example with Ammo.js is what i need with Havok. I tried setTimestep method but nothing changes. My code here. How to fix this issue with Havok?

cc @Cedric

Indeed, there is something wrong with time steps. I’ll fix that this week and it should be part of next Babylon.js npm release this week.

1 Like

Unit is seconds. Please note high value may introduce collision issues like lack of detection.


Hey! @Cedric @Evgeni_Popov
It looks this is still an issue, I’m trying to apply the setTimestep but it doesn’t change the speed at all.
Here is a playground
I tried to put different values but it doesn’t really change.
Also able to reproduce in my local env using “@babylonjs/havok”: “^1.3.4”
Not sure if the PR is in the current release (1.3.4), do we have some release page for the plugin like we do for babylon Releases · BabylonJS/Babylon.js · GitHub ?


You need to set Havok plugin to not use delta time provided by the browser. like this :

1 Like

I was testing the sandbox in fps locked firefox and unlocked chrome and the physics engine does not run on the timestep. @Cedric do you know why this is happening?

with disabled delta time, timestep is being used. but it’s becomes dependent on the framerate.

Do you know if there is any way to limit it to run only on certain frames so it only runs when the timestep has passed?

Maybe you’ll get expected results using non wrapped Havok function:

var hk = new BABYLON.HavokPlugin();
// enable physics in the scene with a gravity
scene.enablePhysics(new BABYLON.Vector3(0, -9.81, 0), hk);
hk._hknp.HP_World_SetIdealStepTime(, 1/3000);

This will change Havok Timestep internally.

That unfortunately did not work
Is there anything else that you can think of that would work?

If I understand correctly, you’d need to way to set a time factor?
This factor would be used to modulate delta time or fixed time step.

It’s more like I only want the engine to run at a certain tps so that the physics is identical on two machines with different fps

@Cedric do I need to manually control the physics schedule?

I don’t think this is possible. It’s not only because of timestep but float precision, deterministic,… Usually there is an authoritative server and physics is replicated/interpolated on client. Cosmetic only things do not need to be synchronized or exact from 1 machine to another.

I actually tried deterministicLockstep and it worked, I think I thought that was only for animations, does it have any performance impact, such as deterministic calculations instead of fast ones?

not that I’m aware of. I doubt there is any.

Cool, thanks so much for the help!

And for anyone who stumbles on this thread I think I had to do both deterministicLockstep and setting the timestep with the _hknp raw wasm timestep function.