# Physics Simulation Inconsistency

**URL:** <https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529>\
**Category:** Questions\
**Created:** [December 13, 2022, 3:08pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529 "2022-12-13T15:08:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioaleo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marioaleo/32/28587_2.png) [@marioaleo](https://forum.babylonjs.com/u/marioaleo)\
**Post date:** [December 13, 2022, 3:08pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529/1 "2022-12-13T15:08:02Z")

</div>

Hi there,

So I have a playground([https://playground.babylonjs.com/#93HGU7#100](https://playground.babylonjs.com/#93HGU7#100)) 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?

Thanks

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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 13, 2022, 5:44pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529/2 "2022-12-13T17:44:56Z")

</div>

cc @Cedric

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [December 13, 2022, 5:47pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529/3 "2022-12-13T17:47:22Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [December 13, 2022, 6:12pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529/4 "2022-12-13T18:12:54Z")

</div>

Have you looked at the locked time steps ? [Using A Physics Engine | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#setting-the-time-step)

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.

---

<div class="post-metadata">

**Author:** ![marioaleo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/marioaleo/32/28587_2.png) [@marioaleo](https://forum.babylonjs.com/u/marioaleo)\
**Post date:** [December 14, 2022, 9:05pm UTC](https://forum.babylonjs.com/t/physics-simulation-inconsistency/36529/5 "2022-12-14T21:05:26Z")

</div>

Unfortunattly no ☹
