Get distance left to traverse for an agent?

65 views
Skip to first unread message

J D

unread,
Feb 17, 2020, 6:23:09 AM2/17/20
to recastnavigation
I am trying to build a system that detects if an agent is stuck.

One way is to check movement itself - if the agent barely moved in a while, it is likely stuck.
However, there are other cases, like agents running around, trying to find ways and not finding them - those cases have movement, but can be considered stuck anyway.

A safe bet would be to calculate the distance left to traverse in regular intervals. If that distance doesn't decrease noticeably in a while, the agent can probably be considered stuck.

But: How could I do that?
I would guess it could somehow be done with the corridor each agent has, or the corners.
However, I am having trouble coming up with a way to use these classes. It would be great if there was a "distanceLeft" function or something like that.

Niello

unread,
May 8, 2020, 10:51:58 AM5/8/20
to recastnavigation
Hi. You may use findStraightPath and then sum up distances between returned points. The wrapper function will be pretty straightforward.
Reply all
Reply to author
Forward
0 new messages