I am making a first person shooter for PC and possibly web player, with a lot of objects in the scene at one time.
I am using sphere/box/capsule colliders for the physical collision detection as I have read that they are faster than mesh colliders. But for detecting bullet hits (raycast and rigidbody) this won't be precise enough, and really I need the precision of a mesh collider. I am thinking of putting mesh colliders on everything that is meant to be hit by bullets, and putting these colliders on a seperate layer that only collides with projectiles.
Will this have a large affect on performance? I know mesh colliders are slow but surely if it is only colliding with one layer the physics engine will have a lot less to do each frame? Also, as a lot of these mesh colliders will be on rigidbodies, will that make a difference?
So, please could someone answer these three questions:
How much will a lot of mesh colliders affect performance?
Will putting the mesh colliders on a layer colliding with only one layer (or even no layers, as I could easily make the projectile weapons use raycast instead) improve their performance?
Does it matter if a mesh collider is on a rigidbody?
asked Jul 31, 2013 at 06:02 PM
Well you can allways go and check how game would behave with mesh colliders and then return back. But beware, autogenerated mesh colliders will not necessarilly be "precise".
That said, i don't know if this changed, but at least all old FPS never used mesh colliders and i doubt you noticed it. Look at quake 3 hitbox. It is not very representative of a character yet i doubt you can really notice:
Here are some other examples. A little more precise from other games.