Support Forum

RichAI start-stop issues with endReachedDistance

I’ve been using this pathfinding system for a while now, trying to use the default RichAI as much as possible to avoid any complex issues. Visually, I seemed to be able to get everything to work pretty well, I initially Construct()'ed paths myself, but decided against this because of various that came up there and now simply set the destination of the RichAI. Upon trying to expand further however, I ran into a whole range of issues and decided to go back to the most basic usage of RichAI and build back up from there.

Upon doing this, I realized that even something as simple as the “end reached distance” of the RichAI doesn’t seem to work like I would expect. Setting this to a higher value than almost zero always seems to cause issues in that the RichAI will continually switch between having “reached destination” and still needing to move, which causes it to start-stop multiple times:

endreacheddistance

Note the debug info also showing the RichAI’s “remainingDistance” jittering around. I’ve tried to figure out exactly why this happens, and my best guess it has something to do with the amount of nodes that are in the path, but it seems like something so trivial of a pathfinding functionality that I would expect this to “just work”. Curiously, the AIPath variant seems to work much better in this regard. Unfortunately, I’m not able to use that because that script doesn’t properly work when combining multiple agents & trying to keep it on the navmesh. (even with RVO)

All of this, as you can see in the gif, can be easily reproduced in the example scenes. While in this case the NavMeshGraph is used, the behaviour is the same in the RecastGraph (which is the one I’m actually using)

I’ve of course searched these forums to find an answer, but it doesn’t seem like there are any specific answers as to why this is the case, and how to actually solve it. I’ve even looked into various workarounds, such as:

  • Setting isStopped = true
    Doing this will break other parts of the RichAI, such as the slowdownTime. meaning it stops dead in its tracks. Also, because the remainingDistance seems inaccurate, this may also not stop a the right time.

  • Using XPath & EndingConditionProximity
    This is inaccurate for NavMesh/RecastMesh graphs because they have much fewer nodes. (I don’t understand how I would use TriangleMeshNode.ClosestPointOnNode to fix this in context of a path modifier)

  • Creating a custom modifier (as mentioned here RichAI with PathModifiers - General / Navmesh graph - Support Forum (arongranberg.com) )
    Having issues actually stopping the agent if close enough to path.


Again, it feels to me like this is a very simple case, what’s going wrong?

Bump! Still want to find out why this happens!

Hi

Sorry for the late answer.
I’ve managed to replicate this locally, and I’ll try to investigate why it happens.

1 Like