Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

What are convex meshes, do I need to set the convex mesh collider flag ?

Discussion in 'World Building' started by thefuturebymob, Aug 4, 2020.

  1. thefuturebymob


    Jul 1, 2020

    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 ?

  2. JoeStrout


    Jan 14, 2011
    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.
  3. TimmyTheTerrible


    Feb 18, 2017
    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.
  4. Kabrevre


    Oct 13, 2013
    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.

    Attached Files: