- Home /
Box collider vs Quad(mesh) collider
hey guys.
I keep reading that mesh colliders are inefficient, but I'm not sure if that's just because most meshes are more complex or something else.
remember that the quad is divided into just two triangles. so in case i need a surface to block some objects, is it more efficient(in performance) to use a quad(mesh collider), or a box collider? or a box collider with 0 in x size? I only need to detect collisions from one side.
thanks in advance.
Answer by theInsomniacGameMaker · Sep 13, 2018 at 09:46 AM
I was very curious to find this answer, so instead of reading up things here an there I decided to put this into practice.
I made a scene in Unity where a Quad spawns every 0.3 seconds. 10 units below the spawn I put a Plane to cause an interaction between the two objects.
(All testing was done in the Unity Editor and obviously this is was not a definitive test)
Test 1
First I tried the Quad with the Mesh Collider and I was getting around 1,000 frames per second.
Test 2
Then I tested with the Quad with the Box Collider and to my utter surprise, I was getting between 4,000-10,000 frames per second.
Test 3
Then I made the depth of the Box Collider to 0 and Quads started falling through. So I changed the Plane's collider to a Box Collider and the Quads stopped falling through till the time they were upright. As soon as they would lay flat they would go through. Still, I was getting between 4,000 and 10,000 frames per second.
I think since a cube is a primitive Unity has added optimization for the Box Collider.
I was very surprised by the results.
But in actual practice, it wouldn't matter too much unless you have thousands of objects using a collider. So use whichever collider worry free!