Wander node request

nathanj

Active member
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
 
Just tired this and it worked.

You need to set the Target retries to a value high enough so that when the modifier amount is multipled with the Wander Degrees value it increased enough to give a wide enough range.
 
This is a good request, I've made a note of it. If you want you can send me your changes and I can take a closer look and get it in version 1.6.1. A relatively major update for the Movement Pack will be released this week (version 1.6) and this won't be included in that since it's already ready to release.

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?
I've had the SamplePosition fail before so I don't think that it includes the not walkable areas but that's a good point. I didn't thoroughly test it nor have I gotten any reports on it. Regardless having it be a parameter is a good idea.
 
Top