Support Forum

RichAI with PathModifiers

Looking for some assistance. I’m using RichAI with a custom path modifier. This custom path modifier runs the FunnelModifer logic, then shortens the recalculated path by X amount from the endpoint. In this case I’m calculating a path 10 units away from the target.

For some reason the RichAI is still using the old paths information if the new path endpoint is in another nav mesh triangle. Is there a way for me to recalculate RichPath or RichFunnel parts that it is using?

I have tried setting the destination to the calculated paths endpoint in OnPathComplete prior to richPath.Initialize

Left is my RichAI agent. Right sphere is my target, but I moved it up a small amount so we can see the overlapping pathing lines. The red / blue dotted line is 1 unit length measurements. The original calculated path ends at the purple x. The green pathing line is correct, but the steering line of the agent is wrong. Currently it moves all the way past the path endpoint, and moves to that steering target edge. The red arrow indicating steering target line should be ending at the purple arrow.

Let me know if you have any insight. Or if I need to rewrite my own RichAI from scratch. I basically want to have an AI behavior that maintains a position a certain distance away from the target. My first half of the solution is trimming a calculated path, the second half of the solution is using FleePath to move it away from the target if the target is moving towards the agent.

Here is the final position the agent ends up at instead of the path endpoint.

**EDIT 1

Seems that I need to update p.path which holds a list of GraphNodes that the path goes through when I update the vectorPath in the modifier. I’m not sure how to calculate that yet, maybe check every path point and remove the nodes no longer being travelled through.

**EDIT 2

Reducing the path.path graph node list by the amount of removed vertices in the vectorPath seems to have resolved my issue.

So I suppose my issue is resolved for now. Unless you have any recommendations for how to achieve maintaining a distance from a target unit.

Thanks for rubber ducking!!


As you have already figured out, the RichAI doesn’t follow a list of coordinates per say, instead it follows a list of nodes. Your original solution would have worked with the AIPath or AILerp movement scripts though.