Been trying to figure out why my agents sometimes get stuck at the edge of the Navmesh and I feel like it has to do with the Max Wander degrees value. By default its set to 5, so it's only sampling a very narrow range in front of the agent. This is good as it produces a more realistic movement pattern, however, the problem is when an agent gets to the end of the Navmesh keep trying to set a new destination but they are at the edge and trying to pick a destination that is infront of them, which doesn't exist.
So, what about a degree multiplier value that gets applied every attempt in the TrySetTarget method of the Wander script. This way, if the agent walks to the edge of the wall, the first sample returns false cause its looking ahead to no navmesh, then the second sample surveys a wider area and probably still returns false, but it will eventually get to a point that it can get a valid sample position and allow the action to proceed.
Upon success the modified value can be returned to its original state.
One other question, in the NavMeshMovement script, in the SamplePosition method, in the NavMesh.SamplePosition check it uses Navmesh.AllAreas. Does this mean that ANY navmesh area, even Unwalkable are considered? Would it be possible to feed in the individual agents Area Mask values?
Thanks
Nathan
So, what about a degree multiplier value that gets applied every attempt in the TrySetTarget method of the Wander script. This way, if the agent walks to the edge of the wall, the first sample returns false cause its looking ahead to no navmesh, then the second sample surveys a wider area and probably still returns false, but it will eventually get to a point that it can get a valid sample position and allow the action to proceed.
Upon success the modified value can be returned to its original state.
One other question, in the NavMeshMovement script, in the SamplePosition method, in the NavMesh.SamplePosition check it uses Navmesh.AllAreas. Does this mean that ANY navmesh area, even Unwalkable are considered? Would it be possible to feed in the individual agents Area Mask values?
Thanks
Nathan