Help improving performance with 40-80 rigid bodies.


I’m creating a game where I need physical interaction between tens of objects, I think the average will be around 50. Is this possible to accomplish with v6 devices on android? My coliders should be cylinders but we all know unity (physx) doesn’t provide such primitive, so, I would use a mesh collider. Every mesh collider should be a cylinder of 12 sides. I have seen other games on the store (not unity) that do this and they work nicely. Has anybody tried to accomplish something like this with success on unity?

P.D. I have done some tests with 80 objects with a mesh collider created from a unity3d cyllinder and it really lags. Could anyone give any insights please?

P.D. More data, I have just left 40 objects with just box colliders and still lags a lot. Don’t really know how I could get this better. On the other hand I have lowered the physics iteration to 3 too.

Thanks in advance.

Well hexdump →

First I would like to clarify whether you are using Mesh Colliders or Cylindrical Colliders.

  • Either way, I would suggest you to use box collider as they have less vertices comparatively.
  • Try to make most of the meshes ‘static’ if they are not moving during run time.
  • For rigidbodies, what matters more is - how often do you apply force or torque etc on a rigidbody?
  • Do all the 80 rigidbodies fill the screen on your small Android device? if so, you might have to explain a little bit more on what are you trying to accomplish.
  • Do all the rigid bodies have scripts attached on it? if so, do all the scripts have Update() or FixedUpdate() functions?
  • Final word → Avoid mesh colliders on a mobile device.

Sphere collides are the fastest. Next up are box collides, and very last on the list are mesh collides. The game you liked is constrained to a 2D plane, this changes everything. If I were you I would just constrain all the ridged bodies to the X Z plane ( Un-check all the other options under ridged body including rotations ) and add a sphere collider to each. Do not have a collider for the table that they are moving across, just let the constrained ridged bodies make it look like they are on a table. Write a script that removes the ridged body restrains at the end of the table.