Is it possible to prevent the physicsengine from updating on scene.render()?

I’ve been trying some things with babylon.js, and I’m currently trying to create a custom game loop. But one thing I noticed is that calling scene.render() also updates the physics engine. Is it possible to manually update the physics engine, and prevent scene.render() from updating it?

Mister @RaananW should know:)

You can disable the physics engine loop by setting physicsEnbaled to false on your scene object.
You will be able to run the physics loop yourself by getting the physics engine object from the scene (scene.getPhysicsEngine()) and running the _step function, which is a public hidden function (it is available, but usually reserved for internal use).

If you want to run the step directly on the physics engine you chose (for example cannon) - you will be able to call its step function, but will also need to update the objects yourself.

I hope this answers your question!

2 Likes