Search Unity

Nav generating INSIDE non-walkable objects.

Discussion in 'Navigation' started by sigbuserror, Dec 8, 2016.

  1. sigbuserror

    sigbuserror

    Joined:
    Dec 4, 2010
    Posts:
    5
    So I have been working with Unity for a while and have long been unable to figure out a solution to this problem. We have are trying to use the Unity Navigation system but even when an solid object is set to not be walkable it will only cut the nav at the shell of the mesh, resulting in islands hidden inside the objects. This is true even using the basic 3d objects built into Unity. Is there any way to avoid this? I would like to avoid having to switch to a new navigation system just because of this one issue but it is a major deal-breaker.
     

    Attached Files:

  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,012
    yep a plague of recast. UT's fixing it and with a bit of luck and nagging it'll be in 5.6.
    it's not a deal breaker though, when you spawn, test that it reaches valid points on the navmesh.
     
  3. cyuxi

    cyuxi

    Joined:
    Apr 21, 2014
    Posts:
    26
    The problem is the height of the Non-walkable Object can not be higher than the Agent Height.
    If your agent height is 2, then your Object height cannot larger than 2, otherwise unity wont consider the volume of the object.
    I have tested this with a box, first scale the box a bit larger to get a reasonable volume, then scale it on height(y), and you will see the problem occurs when the height go over the Agent Height.
    I consider this a bug of unity because there is no reason to make a much taller non-walkable object walkalbe inside but the shorter one remains solid... How Ridiculous! o_O:mad:
     
    erenaydin likes this.
  4. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    398
    Perhaps adding NavmeshModifierVolume or NavmeshModifier to your obstacles and set it to unwalkable would be useful. Doesn't suffer from navMeshes being built when too far within the obstacle's collider edges. It would be nice if these could be based of a mesh though, currently just box and cylinder...
     
    laurentlavigne likes this.
  5. Jakob_Unity

    Jakob_Unity

    Unity Technologies

    Joined:
    Dec 25, 2011
    Posts:
    269
    This is nagging a lot of users - we have plans to add a seed-point what will optionally cull polygons not connected to the seed point. Not coming any time soon - until then i second the modifier volume approach (if the shape fits).
     
  6. Alex_curiscope

    Alex_curiscope

    Joined:
    Apr 4, 2017
    Posts:
    55
    This is sooooo annoying, sorry! My god it just seems like a really basic feature? Why can the nav mesh obstacles only be boxes or capsules? I have a bunch of rocks that are irregularly shaped and I'm getting nav mesh generating on the underlying terrain inside the rocks. Just infuriating.
     
  7. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,012
    It's been a while already, over a year already. What's the hold up?
     
  8. butaca

    butaca

    Joined:
    Jan 13, 2014
    Posts:
    1
    Same issue here. Any news on this? The NavmeshModifierVolume workaround is tedious and time consuming. Thanks.
     
  9. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,012
    Temporary solution: bake mesh using colliders
     
  10. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,622
    Unity, been A full year pretty much, a response would be appreciated on this as it is still happening.
     
  11. Alex_curiscope

    Alex_curiscope

    Joined:
    Apr 4, 2017
    Posts:
    55
    The solution is to switch industries to post production - then if you have bugs they'll be falling over their feet to fix it for you :)
     
  12. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,278
    Would love this, any chance of it happening? Or maybe suggestion for us, as we are trying to make the process as automatic as possible due to small team size.
     
  13. AlejandroDaJ

    AlejandroDaJ

    Joined:
    May 30, 2014
    Posts:
    3
    Still a major issue...
     
  14. bagelbaker

    bagelbaker

    Joined:
    Jun 5, 2017
    Posts:
    13
    We have this issue also, we'd love to have this fixed!
     
  15. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,278
    I understand this issue correctly now, it's just the navmesh doesn't really have a volume to it so there will always be the same island inside further down. These areas can be easily checked: assuming your colliders are all convex (they really should be or your game is wasting performance), you can do a sphere overlap check at the destination navmesh. If it collides then you know that destination is inside geometry. This works with convex or primitive colliders because those colliders have volume so the sphere check will register true if inside :)

    Hope that helps, this is no longer an issue for anyone and just poke me with @ if you need more advice, any readers.
     
  16. Laguna_Seca

    Laguna_Seca

    Joined:
    Mar 13, 2014
    Posts:
    120
    And how to deal with it?

    12.png 21.png
     
  17. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,278
    The reason this happens is because navmeshes are technically 2D, so it's "by design". You need to make your code deal with it, but in reality, an agent will fail to path there and you would have no reason to tell them to go there, right?
     
  18. Laguna_Seca

    Laguna_Seca

    Joined:
    Mar 13, 2014
    Posts:
    120
    The problem is that my AI have the functions of a free walk. It is implemented using the NavMesh.SamplePosition function, which defines these zones as accessible for walking. I found a solution to the problem, but I have to do a lot of manual work, closing these empty spaces.
     
  19. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,278
    Yep, don't forget you can raycast the location beforehand (navmesh raycast is 2D and Physics raycast is 3D). Or simply path there and check if it only has a partial path (look at API for this), and can then easily reject it.
     
  20. Laguna_Seca

    Laguna_Seca

    Joined:
    Mar 13, 2014
    Posts:
    120
    I have already done everything manually 33.png
     
  21. GenOli

    GenOli

    Joined:
    Apr 21, 2013
    Posts:
    133
    Nearly 3 years and no fix, this is a travesty...
     
    superdupergc and goldenglode like this.