At what point is a mesh collider equally as performant a compound collider?
Lets says using 1500 Box colliders VS using a 20K Mesh Collider? Surely at somepoint the calculations of each of the box colliders should outweigh a mesh collider of equal verts even though it is more complex?
Answer by Fattie · Jan 16, 2016 at 05:50 PM
You don't use mesh colliders, ever.
About the only time they are used is on ground surfaces.
Purely in theory regarding your question, the answer would, utterly, depend on the actual layout of the situation. (For example if you have (for no reason) a zillion tiny box colliders sitting very near some point, and the only other object is a distance away, PhysX will just instantly occlude them away on that frame, with almost no processing power, you know?) Also, static colliders are quite different from moving ones.
Also just a thought regarding your example "1500 colliders", I'm not sure a scene will run if there are 1500 "real" colliders - let's say, 1500 balls all bouncing around in a marble game - in a scene .. is that just way too many? (Never tried it!)
Anyway, there is never a case in a video game where you need more than a few (say, 4 or 5) box colliders to "make" an object. A car is two boxes, a robot arm that is swinging around might be three, a dog might be two or three - that's it.
I appreciate your question is theoretical, but the only way to know would be to test it; Unity's profiling tools will instantly give an answer just by looking down at that panel. Again, the layout in question would be entirely the deciding matter.
You don't use mesh collider? I disagree. How would you solve this? Also: I worked in the videogame industry, and they were ALREADY using collision meshes 10 years ago... so you actually DO use collision meshes... very simple ones, but you absolutely can, it's normal practice for complex objects.
[1]: /storage/temp/123592-runner-complex-collision.png