I am trying to create an application that uses NullEngine to simulate physics and replay the results on the client (browser).
By using NullEngine and Physics, I was able to perform physics simulations (free fall and collision).
I have confirmed that using runRenderLoop to advance the physics phenomena will give me sequential calculations at about 60 (30?) fps.
Trying to do a 10-second physics simulation would require 10 seconds.
engine.runRenderLoop(() => {
console.log(ballMesh.position.y, ballMesh.position.z);
scene.render();
});
I would like to know how to process this faster.
In the following example, it processes at high speed without worrying about fps, but time does not advance.
for (let i = 0; i < 200; i++) {
console.log(ballMesh.position.y, ballMesh.position.z);
scene.render();
}
Is it possible to run scene.render() without using runRenderLoop as described above, but speed up the process and pretend that time has advanced, and then do a physics simulation?
What would be the best way to do this?