Physics Simulation Inconsistency

Hi there,

So I have a playground( that I’ve been working on for a while that use some real data to simulate it using physics, I’ve been using CannonJS plugin because somehow it has an expected output when working with calculated forces in newton.
The problem is, after finally reaching a good simulation I started to notice that each run has a really different out put, sometimes I need to randomly multiple the forces applied to the object to see the expected tragetory, all of this with the same input data.
Have anyone experienced this kind of inconsistency? Am I doing something terribly wrong and didn’t notice? Or is this inconsistency expected?


PS: In this playground, there’s a velocity log on the console, it’s expected that it almost reachs 0 km/h before stopping, also it’s expected that the tragetory is an arc to the left and them it turns to the right before reaching the end.

cc @Cedric

If you are doing it in a playground then hitting play over and over again I have noticed that will mess with the timing of the physics simulation, does it go back to behaving normal after a hard reload?

Have you looked at the locked time steps ? Using A Physics Engine | Babylon.js Documentation

A (game) physics engine might not be the perfect choice is reproductibility is a concern.

If I understand correctly, you are using a physics engine to do in-between. Can’t you replace it with more deterministic way? If collisions and rigid body computation is not usefull here, I would not use a physics engine.

Unfortunattly no :frowning: