Search Unity

NavMesh feature questions/requests

Discussion in 'Developer Preview Archive' started by spiralgear, Jan 31, 2012.

  1. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    I have been messing around with the navigation system for the past couple of days and have been very impressed with it. It is very fast even with dozens of navagents, and is even quick enough for mobile.


    But there are a few important things I either can't find or aren't implemented. Any help would be appreciated.




    1) Variable size navAgents: The navMeshAgents don't seem to take into account their radius when rounding corners or going through thin hallways. Radius it seems is used only for avoiding other navagents. This leads to large monsters that are 3 meters wide clipping into corners because they take them as if they were 0.5 meter wide humans. I know you can bake the navMesh with a larger radius, but that would just create the opposite problem of the smaller humans taking corners as if they were monsters, and not be able to go through hallways.

    Is there a way to make navAgents take their radius into account when pathfinding? Or have multiple navMeshes in a level, one baked for large navAgents and one for small?


    2) Obstacle layers: Obstacle avoidance absolutely needs to have a layering system. For example you may want a group of AIs in a "squad" to not collide with each other, but still avoid contact with other "squads". It is also important for blocking off areas of the map at runtime to some navAgents but not others. For example in an RTS when a player sets up barrier that his team can go through but the enemy team cannot. You can kind of do this with navigation layers, but only if you know beforehand where these objects will be. Which isn't always the case.


    3) NavMeshes as discrete objects: Is there a way to store and load multiple nav meshes on a level? If I had a tile based loading system that loaded and unloaded 100 by 100 meter sections of a level, and I wanted each section to have a nav mesh how could I go about that? Also if I had a large moving island floating through a level, and wanted a navMesh to be attached to, would that be possible?


    4) Multiple/custom offMeshLink types: It is implied that this is possible in the demos by having both ladders and drop down points, but looking at the code it seems that it is merely detecting whether or not it was a user made OffMeshLink for ladders or one that was generated by the navigation engine for drop downs. But what if I wanted 4 or more different types off OffMeshLink? How would I distinguish between them in code to trigger the proper animations?
     
    Last edited: Jan 31, 2012
  2. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
  3. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    3) no, they are not per object or anywhere close to it.
    And it wouldn't make sense cause the navigation wouldn't work beyond a single tile.

    what you are looking for here sounds more like using navmesh to generate graphs for usage with HPA* and similar where you can make optimal use of the 'descrete tiles with gates' nature, its nothing you will do with navmesh at all as long as its editor generate, as you must generate the navmesh with the placed tiles at runtime
     
  5. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    And what about navAgents with differing widths using the same navmesh? Is there going to be support for multiple navMeshes? Or is it possible for the navAgents to take their radius into account when pathfinding? Obviously not every game can have all of its AI units be the same size, so what is the plan for this?

    How do I tell an AI controlled tank that it is far to big to be rounding corners with only a foot of clearance on a navMesh baked for human sized agents? Or conversely how do I tell AI controlled human that they aren't the size of a tank on a navMesh baked for tanks and can fit through a hallway?
     
  6. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    Am I asking in the wrong place or what? Not being able to have navagents with varying sizes is a big enough deal to make the navigation system a nonstarter. This is not a niche request specific to a single genre or idea. RTS games need it, FPS games need it, RPG games need it.

    Is there already a way to do it that I am not seeing? Is it something that is planned for the future?
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    No you are not asking in the wrong board but you are asking questions to which nothing can be said as you answered it yourself.
    This is the first incarnation of the path finding in Unity and I personally wouldn't use the agents for anything remotely related to 'crowds' for the time being but instead use UnitySteer or something similar thats focused at it as the Agent avoidance is definitely not usable for RTS or crowds at all
     
  8. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    I am not talking about crowds, this issue is a problem with as little as 2 navAgents in a scene. In the most basic of examples, if you have an FPS game with a single human sized navAgent, and a single vehicle sized navAgent, one of them will not path properly.

    Since we are talking about an engine with no source access, I need someone in charge of this feature at Unity to tell me if and when this feature is going to happen so I know whether or not I should bother using unity navigation at all. So is this the right place to find that out, or do I need to send someone an e-mail?

    My god I miss the good old days when you would have a response from a OTEE/Unity-Technologies employee within 2 hours of making a post.
     
  9. Nems

    Nems

    Joined:
    Jul 18, 2011
    Posts:
    65
    @spiralgear :
    I think your questions are pretty relevant and I am curious to know the answers. Especially about NavAgent with different sizes.

    Anybody from the pathfinding team at Unity to shed a light on this ?
     
  10. Phil W

    Phil W

    Joined:
    Dec 21, 2008
    Posts:
    231
    Regarding impassable "choke points", off the top of my head, you could probably work around this with navmesh layers and setting the NavMeshAgent.walkableMask bitmask to exclude the layers that you don't want your larger agents to path through.

    Of course you'll have to break up said choke points either into seperate geometry, or create and import your own navmesh geometry (which may be better for the game experience anyway).

    While we're requesting features, I'd like more control (and readable states) over when the agent starts moving, so character animation can be timed better. I'd explain more but it'll have to wait till I recharge my keyboard batteries... :p
     
  11. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Just download the NavMesh Demo project here :
    http://unity3d.com/unity/preview/download

    but i've got error with 3.5f1 :
    Assets/Scripts/agentLocomotion.js(111,16): BCE0019: 'GetCurrentOffMeshLinkData' is not a member of 'UnityEngine.NavMeshAgent'. Did you mean 'currentOffMeshLinkData'?

    any idea how to fix this ?
    or can't unity update all the demo project for final 3.5 please?
     
  12. KlaRo115

    KlaRo115

    Joined:
    Feb 24, 2006
    Posts:
    675
    Hey there, I've got another question. Could it be that navigation is pro-only? Either that or I can't access it because of the same error sipon reported about...
     
  13. Sp1r1t

    Sp1r1t

    Joined:
    Apr 14, 2012
    Posts:
    1
    Just replace this code in otherLocomotion.js line 112:
    agent_.GetCurrentOffMeshLinkData(link);
    replace with:
    link = agent_.currentOffMeshLinkData;

    sorry for my english =)
     
  14. diese440

    diese440

    Joined:
    May 25, 2007
    Posts:
    105
    Thx a lot Sp1r1t