Result of physics simulation changes depending on camera position


I’m using BabylonJS 6.9.0 and using a custom physics plugin (with version 1 interface) to use PhysX WASM. I know BabylonJS 6 now supports Havok engine but I was on BabylonJS 5 when I started the project so continued using PhysX as it did not break after the update.

However, I did noticed something strange while doing some tests Today. A same simulation is deterministic if all the mesh/impostors are contained in the scene camera but once I reposition the camera to contain only part of the simulated mesh/impostors, the result of simulation changes. Nothing is changed except for the camera position.

I’m not sure whether this is a bug or just some form of optimisation that BabylonJS performs…

Does BabylonJS perform any optimisation routines on Physics Impostors when the mesh/impostor is not contained within the current camera?

Babylon doesn’t render meshes that are out of the camera’s frustum. But that hasn’t changed and has been like this for quite some time. You can set all meshes to be active (a property of the scene) and see if that helps you.

If you want us to look at the scenario you will probably needf to provide a bit more than this explanation. Some code or a playground would be great.

1 Like

Thanks so much!

I now get deterministic simulation results regardless of the camera view when I set the meshes to be always active.

I am noticing the same problem with BablyonJS 5 when I run the same simulation so it could be something on my physics plugin… I will look into it a bit more.