Is there a way to check if a destination is inside a NavMeshObstacle?
I am using this code today to calculate path:
public bool CalculateTheAgentPath() {
if (this.agent != null) { // If agent exist
if (this.agent.isOnNavMesh) {
bool hasFoundPath = this.agent.CalculatePath(currentTarget.position, path);
if (this.path.status == NavMeshPathStatus.PathComplete) {
Debug.Log("The agent can reach the destionation");
return true;
} else if (this.path.status == NavMeshPathStatus.PathPartial) {
Debug.Log("The agent can only get close to the destination");
return true;
} else if (this.path.status == NavMeshPathStatus.PathInvalid) {
Debug.Log("Path invalid");
return false;
}
}
}
return false;
}
The only response I get when player is inside a obstacle is “The agent can reach the destionation”, just if the path was complete. The enemy is walking around the obstacle so I would say that the path is not complete?.
I would like the enemy to ignore player if inside an obstacle.
Anyway to do this?