How to place 100 of objects with rigidbody


#1

Hi,
I need to develop a game , in which atleast 100 small objects will be placed, I need their physics behavior when some object (Ball or Drum) fall on to them or pass through them.
Problem is that for collision every object need Collision and Rigidbody. It takes lots of fps.
Any way to improve fps in this situation.
I am attaching some images


#2

At the moment, Ammo.js is running on the main thread which doesn’t help. Options basically boil down to use less objects or a different physics library:

  • Use less physics objects
  • Modify the engine to run Ammo on worker thread (which not all your players will support this)
  • Write your own physics library to handle simple collisions only
  • Use another physics library that may be more performent
  • If the game is really a 2D physics game with 3D graphics, you can use p2.js which should be faster https://playcanvas.com/project/446127/overview/p2js-integration

#3

Just to follow up, @codebon is currently working on upgrading PlayCanvas’ physics engine (ammo.js) to the latest version which will result in a significant speed up.