- Home /
Mesh Colliders - what is most efficient?
Suppose I have a large model with a lot of polygons. What would be more efficient:
- Create 1 large MeshCollider object with lots of polygons
- Break up the model into, say, 10 smaller chunks, each with a MeshCollider
My instinct says that (2) should be more efficient, but I don't know since MeshCollider is a black box to me. Does MeshCollider have an early AABB rejection? What is its algorithmic complexity?
Any extra information on the performance aspects of Mesh Collider would be much appreciated.
The most efficient would be not to use mesh colliders and just approximate the shape with box and sphere and capsule colliders
Answer by jonas-echterhoff · Aug 10, 2010 at 08:26 AM
- should be preferable due to lower overhead. PhysX will construct one big AABB tree for all static meshes in the scene.
Thanks for the answer, that is good to know. However, what happens if that mesh is, say, a terrain where there are always several objects in its vicinity, and usually within the terrain's total AABB? Will PhysX handle that efficiently?
BTW, the reason I'm not using the built-in terrain stuff is that I'm working with iPhone. So the question is, if there's a pretty big mesh with lots of triangles, and if there are many objects potentially colliding with it, will PhysX handle that well?
I Imagine it really depends on how many triangles it has. It can't be very good for performance... Especially on the iPhone... But again - this is not from experience. I would imagine also that having too much separate primitive colliders can't be that good either. However, if you are going for the $$anonymous$$eshCollider way - try maybe using a lower-poly simplified mesh with no renderer that covers the higher poly mesh - and use that as a mesh collider ins$$anonymous$$d.