Check Distance to Final Waypoint (End of Path)


Is there any example code or API to check the distance to the path destination using A*?

I could check the distance to the target, but that wouldnt accurately represent the distance of the path itself (as the path is rarely a straight line).

Thanks Aron.


In the current release, no.
In the current beta you can do

var ai = GetComponent<AIPath>();
var distance = ai.remainingDistance;

This also works for RichAI and AILerp. However, as is also noted in the documentation, the RichAI script does not know a very precise estimate of this distance, so it will just return a crude approximation (which in the current beta is just the distance to the current steering target + the distance from the steering target to the end of the path).

Cool, thanks. Do you have a general ETA for the release of 4.1 (as an official release) ?

Do you expect a lot of breaking changes between 4.0 and 4.1?

I have no ETA right now unfortunately.

I am trying to keep the breaking changes minimal. You may get several deprecation warnings, but things should still continue to work. If they don’t I would appreciate a post here on the forum.
There are a few breaking changes listed here:
but they mostly have to do with internal APIs that have changed and which are rarely used by user code

Great, thanks for the heads up.

I am working on playmaker actions for release on asset store (along with tutorials). So I will probably target the 4.1 build, as it will take me around a month to get them finished.

I will download 4.1 beta now, ill let you know if anything is weird/not working.

That’s awesome! Let me know if you need anything.