NavMesh area, walkable but not accessible.

Hi,
I would like to know if the NavAgent is going in an not accessible NavMesh area because there is no continuity of NavMesh, but it is walkable.

if(MouseClickOnWalkable && AreaIsAccessible){

MyNavAgent.SetDestination(ThisTargetPosition);
......

No problem for “MouseClickOnWalkable” bool but I need to know “AreaIsAccessible” bool.

How you do?

alt text

2 Answers

2

Use: NavMesh.CalculatePath

Look at the return value by this method. The documentation states that:

Returns

bool True if a path is found.

Description

Calculate a path between two points
and store the resulting path.

This function can be used to plan a
path ahead of time to avoid a delay in
gameplay when the path is needed.
Another use is to check if a target
position is reachable before moving
the agent.

Thanks for the reply but I had already tried this solution.
Even if the target point is located in a “detached area” of NavMesh, the result of NavMesh.CalculatePath is true.