detonator icon indicating copy to clipboard operation
detonator copied to clipboard

Investigate how to limit the number of physics bodies in simulation

Open ensisoft opened this issue 2 years ago • 1 comments

Investigate how to limit the number of physics bodies in simulation. Currently the engine will create physics bodies for all entities that have nodes with rigid bodies regardless of whether they're currently actually contributing to the scene and its game play. For example simulating a physics such as a moving platform body that isn't affecting the user and isn't yet visible in the screen is wasted work.

Related to #37

ensisoft avatar Aug 27 '21 07:08 ensisoft

From physics engine perspective there are 2 ways to approach this.

  • don't create physics bodies for nodes that aren't yet in the scene.
  • if the body is created then use enable flag. this will disable the simulation in Box2D but will not necessarily disable the (expensive) computation inside the physics subsystem when updating and going over the scene.

ensisoft avatar Aug 27 '21 07:08 ensisoft