- Home /
Wich is faster? Mesh collider or lots of primitive colliders?
I am making the map geometry of my game, and it has a big city where you can go inside most buildings, and i was making the collision for the meshs combining lots of primitive colliders. But it takes too much time to make, so i was wondering if i could'nt just use a mesh collider instead. Will it affect too much my performance?
Example:
I have a large building, Its made out of around 4000 polygons. Around 3000 vertices. And its composed by near 76 box colliders.
Took a while to make. Would it be better to use a mesh collider?
That depends on the shape. Also consider that statically marked colliders are highly optimised because their collision data can be "baked" into a tree and therefore only checked if it needs to be.
you never use mesh colliders for anything.
"But it takes too much time to make"
that's called "making a video game" :) most of making a game is sitting there deciding how to make the colliders, that is to say box colliders, work.
Agreed you never use default mesh colliders, but in many cases its beneficial to use a lower poly mesh as a collider (either way you'll have to spend some time on colliders). 4000 tris is WAY to many for today's performance capabilities.
Answer by zanearn · Nov 12, 2013 at 02:48 PM
Given the number 4000, I think it is safe to say primitive colliders will still win. But hey, don't worry about the performance until you really sees an impact. So just use mesh collider and test the game, if it is ok then mesh collider it is. Make box colliders only when you have to.
I've seen approximate lower-poly meshes used as mesh collider of higher-poly one, but it's rare.
Never, ever use mesh colliders.
(The only exception really is, in certain cases, for ground surfaces.)
"I've seen approximate lower-poly meshes used as mesh collider of higher-poly one, but it's rare."
Well it's not really rare - it's exactly what you do, in every project where that is relevant, just as GraphicsDev mentions. But it has no connection to the question at hand from the OP.