Hi all!
I was playing around with the PG in Advanced Animation Methods | Babylon.js Documentation and tried adding setSubTimeStep
.
I assumed that setSubTimeStep
would not affect the number of seconds a simulation would take to run. My understanding may be wrong, but I thought that setSubTimeStep
would insert simulation steps in between our chosen timestep (with physEngine.setTimeStep(1/60);
) to help us increase the resolution of our simulation.
PG with setSubTimeStep: https://playground.babylonjs.com/#DU4FPJ#167
// console.log output
sphere is at rest on stepId: 33
duration: 0.616
box1.rotation.y is: 1.7000000000000008
PG without setSubTimeStep: https://playground.babylonjs.com/#DU4FPJ#168
// console.log output
sphere is at rest on stepId: 551
duration: 9.226
box1.rotation.y is: 27.600000000000257
By setting setSubTimeStep(1)
, not only does the simulation complete much faster, but also the number of simulation steps has been reduced from 551 to 33.
Could someone please help clarify if we should expect this behavior? Thank you for your help!