FleePath inside enclosed tag-region - runs directly to enemy :(


Hey Aron, I’m using FleePath, and encountered 1 thing, which I verified in the " PathTypes" demo scene as well.

I’ve marked-out a region of my entire nav-mesh and adjusted PathTypesDemo.cs for any FleePath to have a tag (1<<1). This forces the paths to stay in the blue region.

In the game view, I’ve set the flee strength to 1.0 the spread to 0 and the Search Distance to 100 000.

The flee path was computed from start sphere (bot right corner) directly to the enemy (top left corner).
Basically, the requested path length is too long, and doesn’t fit into the region. It’s inevitable that the path has to be clamped, but I would prefer the agent to run rightwards, definitely not left (not towards the enemy)

If start sphere is positioned nearby of the enemy, within the left half of the tag-zone, the FleePath is computed correctly, towards the bot right corner, away from the enemy. It’s just that putting them on different sides of this blue zone causes this unwanted behavior

How should I correct this?



The flee path’s search length is the minimum length of the path it will look for. If there are no paths of that length, it will pick the longest one possible, which in your situation restricts the possible options quite a lot. Try reducing the search length perhaps?