- Home /
What is the best practice in handling scenes with 100+ rigidbodies and collisions on iOS?
I have a scene with lots of houses and other objects. These objects will be bombarded from the sky. How to you handle these kind of sets having in mind that you want the physics to be as realistic as posible.
If I set all the objects with isKinematic=true and on Collision I set it to false, than the physics isn't as realistic as I want to... Can you have these kind of scenes on iPhone? Should I have animated objects? I really don't know what is the best practice in this kind of scenes....
Answer by demize2010 · May 23, 2011 at 09:16 AM
First up define lots ;)
Performance on mobile devices is a challenge at the best of times... depending on what you are doing you may find that you run into trouble quite quick, all those physics calc's chew up cycles that are required for rendering as well.
Your target platform is key here, probably the best approach is to simple get the lowest spec device you will support and build against it incrementally as you develop the game. That way you'll be able to gauge the performance hit of whatever it is you are doing.
Check our your physics matrix and make sure that collisions are only being checked between required layers. Follow this logic for understanding how expensive different colliders are (from least to most):
Sphere > Cube > Capsule > Cylinder > Mesh
Hi, I've edited the question, lots = 100+ objects. On the device my test with 200+ rigid-bodies hardly runs. But maybe I'm doing something wrong and I don't know what is the approach or if you can handle that many objects.
I think in short that's possibly way too much. It depends on your collider type. We've managed 60 on an Android 1ghz device using sphere capsules only - but it totaly depends on everything else your asking the CPU to do as well.
I went to soon into the game saying "Woohooo Phyiscs, so awesome!". But from what you are saying I understand that I cannot have on an iPhone 3GS more than 50 rigidbodies + other animations and stuff. right?
It really depends on your game and whats going on to be honest. Everything is pushed through the CPU on most mobile devices, so graphics, sound, physics etc. That being said, you should be able to get away with 50 rigidbodies if they use primative colliders (eg sphere or box)
Also, in these kinds of cases it's probably better to use your imagination and program creatively then to actually have a hundred active rigidbodies.