Using off-mesh link with a custom movement script and funnel modifier


First off, excellent work, readable code, great performance – and great book recommendation “AI Game Programming Wisdom 4”. I’m about halfway through already. I checked the forum as much as possible, tried several things within the code, and read most of the code in the package but could not find a way to resolve my issue.

Here is my use-case, simplified:

  • Humanoid movement
  • Recast graph for primary movement
  • Point graph for node links

It all works when I use it with the RichAI component, including the off-mesh links. The issue is that I need to write my own movement script. I read your implementation, line by line, within RichAI and I have a pretty strong understanding of how it works (even if I can’t say I could have written it from scratch).

My issue is that I need the Funnel modifier but also I need to detect when the agent arrives at an off-mesh link so I can traverse it (which involves a usually-impossible Y-axis shift and playing an animation). Now, it looks like you’re not using your typical Funnel implementation within Rich AI and are instead using custom code to do the same thing.

The reason I don’t want to just use the RichPath component you’ve setup to do the custom modifier is that I have multiple agent types (and movement scripts) and I’m trying to keep things isolated architecturally on their correct layers. So I’d like to keep myself isolated, for pathfinding, to the Seeker component and the path modifiers.


  • Why? if there was a limitation within the Funnel modifier preventing Rich AI from using it, why not just update the modifier implementation instead of writing a new Funnel modifier?
  • Is there any way to detect when arriving at a mesh link while using the Funnel modifier?

I suspect the answer is that you can’t do it right now. If that’s the case I’d like to request a recommendation for a path forward and/or if it’s possible to add this functionality.

Thanks for your time,


Thanks for the kind words :slight_smile:

  1. The difference is that the funnel modifier transforms the path once from a list of nodes to a list of points. The RichAI’s internal funnel modifier is a bit more sophisticated, it tracks how the agent moves at runtime and runs the funnel algorithm every frame up to the next corner (which is usually very fast). It can also repair the funnel if the agent happens to move outside it (e.g if it was pushed by some agent). You can clearly see the benefit of this if you make the agent recalculate its path very seldom, and then drag the agent around in the scene view. If you compare the result with the AIPath script you would see that the AIPath script quickly gets very confused while the RichAI script can usually manage to figure out where it should move even without a path recalculation. This cannot be done for the AIPath script however as that script is much more general and has to be able to traverse graphs that do not have a well defined surface (e.g a point graph).
  2. Not really. The funnel modifier merges together all path parts into a single sequence. I have a work in progress branch where I have redesigned the modifiers and movement script so that it is much easier to detect off-mesh links using any movement script (and also improved some APIs a lot in the process). In that version all modifiers process the path on a part by part basis (where parts are separated by off-mesh links).

Makes sense. So, if I understand correctly, the RichPath piece of RichAI is the better way of doing it. You’re taking that concept and applying it to the modifiers. At that point detecting the off-mesh links while using the funnel modifier will be possible.

Any ETA on that update? I can email you my invoice number if you’d like a beta tester.

Yes, that’s precisely right. Or at least many parts of the RichPath class.

I could upload a beta right now if you want, there are many work-in-progress things in it, but off-mesh links work for both RichAI and AILerp in that beta so you should be able to implement your own movement script using the same functionality.

Yes, please. I’d like to try the beta.


Sorry for the delay.
I will upload a beta soon. Currently having a busy few days.

OK, sounds good. Thanks!


I have uploaded a beta now. You can find it at (click the ‘show older versions’ button and download the path_api_rework beta).
But… yeah, this beta has a lot of changes to the API and there are a lot of rough edges right now.
It should work for the most part though (at least most of the example scenes work).

Anyway. The core change is that paths now have a result field which contains for example the nodes and points that the agent should follow when using an ABPath.

If the path contains off mesh links the path has been split into separate parts and can be iterated over. There is a simple iterator that can be got using ABPathResult.GetPartIterator which allows you to iterate over the parts in your movement script and also get info about which links the path contains.

Thanks! I’ll play with it over the next few days and let you know if I run into any issues.