How does the RichAI.remainingDistance works?

The documentation says “Remaining distance along the current path to the end of the path.” and the implementation is just getting the distance between two vectors plus a small distance to the next steering point.

So, I’m assuming the remainingDistance is not actually calculating the distance “along the path”. I mean it’s not similar to what the Path.GetTotalLength() is doing. Or am I missing something?

From further down in the documentation for that property:

For the RichAI movement script this may not always be precisely known, especially when far away from the destination. In those cases an approximate distance will be returned.

Calculating the exact distance would be pretty expensive. You can use the GetRemainingPath method if you want to calculate it (you’ll need to sum up the distances along that list manually though).

The Remaining Distance property will be accurate near the end of the path however. Which is usually when it is used.

Yeah, that’s what I’m doing, using the GetRemainingPath. But I feel like the wording in the document is a bit misleading when it says “along the path”. Maybe mentioning that it does not take the path into account when calculating this distance, making it more clear.