Having an issue i think i know why it is happening but not the correct way to get around the issue.
My Nav Mesh agent picks a random point in a circle and walk towards it for a random amount of time, when the position is valid it looks normal like this.
But every so often the agent picks a spot it cant walk to and just stands there for the time it has been allotted to walk for and then picks another and moves again, while it cant walk this happens.
I know that the reason it is not moving is because the path is not valid (or at least i think that is why.)
But i have tried implementing something like this with no luck.
private void moveTowardsWaypoint()
{
agent.ResetPath();
Vector3 newPosition = new Vector3(randomDirection.x, 0, randomDirection.y) + transform.position;
NavMeshPath path = new NavMeshPath();
Debug.Log(agent.CalculatePath(newPosition, path));
if(agent.CalculatePath(newPosition, path) == false)
{
agent.ResetPath();
StopCoroutine(walkTime());
pickWayPoint();
}
else
{
agent.SetDestination(newPosition);
}
}