I am using my own Wander Script that uses SamplePosition to find a position to go to, for some reason this doesnt always return a position on the NavMesh but I can live with that for now.
protected bool SamplePosition(Vector3 position)
{
NavMeshHit hit;
return NavMesh.SamplePosition(position, out hit, navMeshAgent.height * 2, NavMesh.AllAreas);
}
I am wondering if I can get this to respect the area costs somehow? so that if there is a road they will pick a random point on a road instead of a random point in rough grass for example.
Much like this video: https://arongranberg.com/astar/docs/images/random_point.mp4
In this video it doesnt just walk around the high cost area, it actually chooses it less times as a destination too, which is what I want.