I have found that in my code agent.remainingDistance was returning infinity. The docs say this is the case when the agent does not know the remaining distance. I checked agent.pathPending and it returned false. What else could make the remainingDistance infinity, if it knew the path?
I found another way to solve my issue, but I still would like to know why it had happened in the first place.
I read somewhere that remainingDistance is only calculated once the agent has almost completed its path, specifically when the agent has begun traversing the last segment. Before that, remainingDistance will return infinity.
1 Like
Okay. That is what I observed. Then how is that even useful?
2 Likes
Yeah, it’s a shame. I assume this is done as an optimization, though I can’t say for sure.
1 Like