Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Triangle Mesh and Heightfield Trigger are not supported!

Discussion in 'Unity 5 Pre-order Beta' started by davem250, Oct 27, 2014.

  1. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
    Hi i have stumbled upon this error in one / some of my scenes...
    I have no clue what it means or how to remove it!

    The precise error message is as following:

    NpShape::setFlag(s): triangle mesh and heightfield triggers are not supported!

    I would really like to know how to remove this as i am pretty sure that it is this error that is making my scenes lag under startup! Thanks in advance for any help i can get :)
     
  2. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    It's most likely because you have a mesh collider component set to be "is trigger" somewhere in your project. Going forward Unity 5 does not support this setting. I'm sure there's a reason for this, but I sure couldn't tell you what it is. It created some problems in my own project and I had to figure out a workaround. :(
     
    IntDev likes this.
  3. davem250

    davem250

    Joined:
    May 28, 2013
    Posts:
    186
    Well chingwa... i have some extremely good news :D it was simply because ALL of my objects that called this error had a mesh collider attached to them (some were isTrigger enabled!) but i found that turning on Convex made the error disappear :D
     
  4. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Woah. So that's why I'm getting these errors. That's kind of serious for me. Do you mind if I ask what your work around was? The colliders for my roads are generated by splines so making them convex isn't really an option.
     
  5. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    And those colliders are triggers?

    PhysX 3.3 doesn't support non-convex mesh triggers, so you're going to have to break your trigger down into convex pieces (or into overlapping BoxColliders or similar).
     
  6. root8888

    root8888

    Joined:
    Jul 25, 2013
    Posts:
    26
    I can't seem to find any colliders in my scene that have "Is Trigger" checked. Does anyone know a way to search for them?
     
  7. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    A little editor script is probably the simplest way:

    Code (csharp):
    1.  
    2. public void SelectAllMeshTriggersInScene()
    3. {
    4.    Selection.objects = FindObjectsOfType<MeshCollider>().Where(mc => mc.isTrigger && !mc.convex).Select(mc => mc.gameObject).ToArray();
    5. }
    6.  
     
    root8888 likes this.
  8. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    Yes that works, unless your mesh collisions don't work properly with a convex mesh, as in my case :(

    For my project I was using them as triggers in order to accept raycasts... I turned them off from being triggers in order to get rid of the error, and then put them on their own layer and disconnected that layer from all the other game layers in the physics settings... this way no other game objects will interact with those colliders, but the raycasts still work. It's a bit annoying to have to do this, but it worked in my case.
     
    Deleted User likes this.
  9. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Ah I see. Thank you, that's a good solution. I can do the same since I'm doing a raycast straight down to determine footstep sounds anyway.
     
  10. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    (That wasn't me, but yes, I agree it sounds like a good solution).
     
  11. djweinbaum

    djweinbaum

    Joined:
    Nov 3, 2013
    Posts:
    533
    Oh whoops I meant to quote @chingwa
     
  12. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    This error is doing my head in. I get 5 of these pop up every time I hit play and then 5 more when I hit stop. I have triple checked my scene and I definitely don't have any mesh triggers, let alone any that aren't set to convex.

    I don't I know what else to do. Could the error message be updated to say which object is causing it or something?

    Edit, every now and then I get a slightly longer version of the error on it's own. It reads:

    NpShape::setFlag(s): triangle mesh and heightfield triggers are not supported!
    UnityEditor.DockArea:OnGUI()

    Any ideas?
     
    Last edited: Dec 14, 2014
  13. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    That's weird... maybe something from the assetstore?
     
  14. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Good idea. Although, unfortunately, the only thing I'm using from the asset store is a skybox.
     
  15. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Hmm...

    I can't for the life of me think of why you would use a mesh collider in an onGUI method...

    It's more likely the UnityEditor.DockArea:OnGUI() part is not related to the actual problem, but just an artifact of the error reporting. When I googled just "UnityEditor.DockArea:OnGUI()" I found a ton of unrelated errors that had it in the string somewhere.

    Did you try the editor script Superpig posted?