Box or Sphere Trigger Performance

I was in the process of making a melee attack with a trigger infront of the character and thought, I wonder what best to use in terms of performance, a box or sphere collider for a trigger.

Is there any difference in performance vs box and sphere triggers?

I searched forums and google and couldnt find anything. I would think box would be better for performance because there is less polys to check or I would think less calculations, but I read somewhere that spheres are the best.

Can anyone offer any insight or confirm what is better performance wise. Thanks for your time :slight_smile:

Intersection tests involving boxes and spheres are not expressed in terms of polygons. Rather, mathematical representations are used (e.g. center point and radius for a sphere, center point, axes, and extents for a box).

In general, intersection tests involving spheres are more efficient than those involving boxes. However, in this particular context, whether you use spheres, boxes, or capsules is unlikely to have any noticeable impact on performance, so I would just use whatever shape makes the most sense, and then deal with any performance issues only if/when they come up.

The main difference in performance is between mesh colliders and primitive colliders (meshes are much slower). The difference between the primitive colliders isn’t enough to have any noticeable effect in the game.

Don’t neglect capsules. The performance difference is indeed negligible, but there’s no reason not to err on the side of round if there’s any confusion about what would best fit.

http://forum.unity3d.com/viewtopic.php?t=36346

Yup. Another vote for capsules. I have had more success with using capsules for triggers (and defining clickable areas). There have been times that I’ve used a Cube, and could not get any reliable results, swapped to a capsule and was much happier.