Hi,
I have some meshes imported in from Blender that represent some islands my character can walk on, these island meshes contain holes that represent water wells, the holes do not go all the way through the mesh. I then fill these wells with water, put a collision box just below the surface of the water so I can tell when the character has fallen in the water. Unity generates the Mesh Colliders from the island meshes, and everything seems to work fine. However I’ve been reading up on convex mesh colliders, and it sounds like my meshes are concave (as they have holes in them. So firstly - is this true - is a floor with a hole convex, and secondly what is the Convex tick box item for on the mesh inspector tab ? Not ticking it seems to work fine, should I be using it ?
Thanks
You should use it whenever your collision mesh is, in fact, convex. I’m not sure how to explain what a convex mesh is, but I bet someone has done so, and that you could find it via your favorite search engine.
Convex meshes are quite a lot more efficient to collision-check against, which is why Unity supports only convex meshes for dynamic Rigidbodies. For static geometry like a floor, a non-convex mesh will work, but it will still not be as efficient as a convex one. So use convex when you can, non-convex when you must.
1 Like
Basically the convex check mark will make a collider around your mesh without any ‘indented’ areas. Say your mesh is a jail door made out of bars. With a mesh collider you could still shoot between the bars. But if you check convex, unity will make a more optimized collider around all if the bars, but your not gonna be able to anything between them.
It’s easy to visualize if check the box and preview the collider gizmo that is generated.
9 Likes
The convex option is like stretching rubber bands between the outer-most vertices. Just like Tiimmy said, Unity makes a more efficient mesh for objects like this rock example. You could also think of it as gift-wrapping your mesh. Irrespective of how helpful it is, primitives are nearly always going to be more efficient.
1 Like