Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mesh Collider Broken?

Discussion in 'Editor & General Support' started by Drebble, Apr 10, 2019.

  1. Drebble

    Drebble

    Joined:
    Apr 10, 2019
    Posts:
    7
    Hi

    I've tried adding a low poly mesh collider to an object. When I load the low poly mesh into the mesh collider there is no green version of the mesh visible (as there is in the "official" Unity tutorial). If I select "convex" then a green generated mesh appears and seems to work.
    With rigid body enabled the object (with mesh collider) falls through the floor unless the convex option is selected.

    Uploaded image shows identical models, on the left with convex ticked. UnityMeshColliderScreenGrab.JPG

    So it seems to me there is no collision mesh being generated unless the convex option is used, which results in an inaccurate collision mesh.

    Tested in Unity 2018.3.3f1 and 2017.4.11f1 with two different 3D models (with low poly collision objects) exported to Unity via FBX and OBJ.

    Am I doing something wrong? If so I'd appreciate some help.

    Cheers
     
  2. Drebble

    Drebble

    Joined:
    Apr 10, 2019
    Posts:
    7
    Update, so as far as I can tell the mesh collider works correctly if the "Kinematic" option is ticked, is there a limitation in unity that does not allow mesh colliders to operate with the rigid body system?

    Cheers
     
  3. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    iirc non-kinematic rigidbodies can't have non-convex mesh colliders
     
  4. Drebble

    Drebble

    Joined:
    Apr 10, 2019
    Posts:
    7
    Thanks for the reply, so the answer is YES, there is a limitation in Unity that does not allow non-convex mesh colliders on rigid bodies. Can you please point me to the Unity documentation that points out this limitation and maybe any workarounds?
    Cheers
     
  5. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    You can create a model with lower number of polygons to be used as a collider. Make sure that the newly created model is an accurate representation of the mesh collider you want to use.

    Or, even use multiple simple colliders. In your case, a capsule collider will work for the handle, 2 sphere colliders for the ball parts.
     
  6. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    workaround (actually, the right way) in your case is to use 1 capsule collider and 2 sphere colliders
     
  7. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,614
    This! Compound primitive colliders are hugely faster then mesh. I imagine a sphere collider is probably just as fast as even a single triangle of a mesh collider.
     
  8. Drebble

    Drebble

    Joined:
    Apr 10, 2019
    Posts:
    7
    Thanks Dextozz, drcrck, the barbell was just a test object to demonstrate the issue, the actual project assets are far more complicated, hence looking at low poly mesh colliders.
    We're also having problems with the OVR distancegrabble script because this depends on colliders that currently don't appear to work as expected with rigid bodies.

    Cheers