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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Concave Mesh Colliders can no longer act as triggers (Unity 5)?

Discussion in 'Editor & General Support' started by Aurecon_Unity, Apr 7, 2015.

  1. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Hi All

    Has anyone else noticed that mesh colliders can only act as triggers if they are marked as 'Convex'?

    This is opposite to previous behavior, and must be a recent change - the interface for the mesh collider has also changed and this isn't yet reflected in the help file (still show the old interface).

    Can anyone from Unity chime in with any additional information on this?

    This is actually a huge issue for me - I produce large scale engineering visualisations and our whole layer system is built around triggers - when a layer is switched off, all the mesh colliders become triggers so that the various raycasting functions and flying cameras don't bounce off hidden objects.

    With the new system, you must make Unity draw a low detail convex boundary around the mesh so the collider no longer represents the physical dimensions of the mesh, rendering it useless for my purpose.

    The system that I use was devised after much trial and error - enabling and disabling gameobjects was taking too long at runtime, as was enabling and disabling the collider itself, so the trigger solution was both easy on performance, simple to implement and works exactly as intended.

    Is there any reason for this change? Can it be hacked somehow in code? I'm in a bit of a panic right now, because I'm 90% finished porting my system to Unity 5 and this is a massive snag. I'm sure I am not the only one that is going to be affected by this - I daresay that a lot of people who use Unity for non-gaming related purposes use triggers in a similar fashion.

    Thanks!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes; this is because the new version of PhysX doesn't support it. You can use multiple convex meshes instead.

    --Eric
     
  3. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    If your meshes are just quads or cubes you're better off using a box collider (which can be a trigger still). It'll also perform better.
     
  4. Aurecon_Unity

    Aurecon_Unity

    Joined:
    Jul 6, 2011
    Posts:
    241
    Thanks Eric, so it is a PhysX limit then.

    Unfortunately using multiple convex meshes isn't an option - my models are complex engineering shapes and breaking them down into convex shapes wouldn't be feasible.

    I'm at a bit of a loss now to be honest - any suggestions on workarounds?
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It should be feasible, even if not easy; here is the first result I got with a search. Although it seems like you could just use a different layer, and have the raycasts ignore that layer.

    --Eric