PathEndingCondition example

http://www.arongranberg.com/astar/docs/_ending_condition_8cs-example.php

The example script for PathEndingCondition didn’t work, the seeker didn’t move. help! it seems tested for 3.0.7.

I would like to make the seeker follow a target and stop in front of the target with a certain distance

Hi

That script simply shows how to use it. It is not a movement script. If you pause the game at start and step frame by frame you should see the debug lines it draws when it has calculated the path.

What I see the path is still end in the target position, if I increase the value HLimit, the p.vectorPath.Length is shorten, but still end in the target position.

That is probably the StartEndModifier on the Seeker. It will by default adjust the endpoint to lie at the exact point requested. Change it to ClosestOnNode or something else and you should be good to go.

EndingCondition HLimit = 1000, Exact End Point = Interpolate

EndingCondition HLimit = 1001, Exact End Point = Interpolate

What I need is that the player can find a path that stop just in front of the target player
without touching it.

You cannot find a path with greater precision than the graph resolution. In your example that means that the units will either be about one meter from each other, or at the same point. I would instead recommend local avoidance approaches to that, they can try to adjust the movement of the characters to not get too close to other units.

Or you could adjust the endpoint of the path yourself if you know that the path should actually be x units shorter.