I know this has come up before, but it never really seems to have been settled. Is there a reason that Unity seems to be missing some basic primitive colliders?
Specifically it seems like the math would be very simple for:
-A Point
-A Line
-A Cylinder
-A Cone
-A Ring
-A Pyramid
-A Wedge
And I know that there are extra primitives available on the store, but don’t all of them just use mesh colliders which defeats the purpose of using a primitive?
Unity uses PhysX for 3D physics, so it depends on what PhysX has support for. The math for performant collision testing isn’t that simple for most of those (e.g. cylinder, ring) and you can just as easily use convex mesh colliders, except for rings. There’s no such thing as a point collision, since that wouldn’t physically exist, being a 0-dimensional object. Lines are also not something that exist in 3D, although edge colliders exist for 2D collision.
Unity has the primitives it has and to my knowledge has no intention of adding more, which is a pretty solid definition of “settled.”
Now, there are people out there who think Unity should add more primitives, and the matter is not “settled” to them because they do not like the answer.
That’s a pretty strong clue that having a primitive would not be appreciably better or faster than using a well-designed mesh.
What about using constructive solid geometry with union, intersection, difference? PhysX has a batch mode so it would just be a case of doing the checks in a batch then “and”, “or” or “not” 'ing the hits into a final result. It might even be faster to use a CSG collider than a mesh one?
You could just code it in C# but you would lose the potential batch PhysX performance boost.
There is also a blocking query which improves performance, (checks to see if the LOS is blocked by obstacles) not sure if this surfaces or is used in the Unity API.