Search Unity

Find if NavMesh area is walkable but not accessible.

Discussion in 'Navigation' started by WILEz1975, May 18, 2015.

  1. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    375
    Hi,
    I would like to know if my NavAgent is going on a not accessible NavMesh area (because there is no continuity of NavMesh) but it is walkable.



    Code (csharp):
    1.  
    2.     if(MouseClickOnWalkable && AreaIsAccessible){
    3.  
    4.     MyNavAgent.SetDestination(ThisTargetPosition);
    5.     ......
    6.  
    No problem for "MouseClickOnWalkable" bool but I need to know also "AreaIsAccessible" bool.


    Otherwise the character moves up to approach the target point. I wish that when I click on a not accessible area, it does not move.
    How you do?
     
    Last edited: May 18, 2015
  2. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    375


    NavMesh.CalculatePath does not work.
    Even if the target point is located in a "detached area" of NavMesh, the result of CalculatePath is true!
    Why??
     
  3. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
  4. RomanLed

    RomanLed

    Joined:
    Apr 25, 2014
    Posts:
    3
    //Check if path is continuous to destination
    if (agentNav.pathStatus == NavMeshPathStatus.PathPartial)
    {
    //etc...
    }