I’m using RichAI agents on a RecastGraphs, which for now works pretty good in my project.
Now, I’m trying to create behaviour, where Agents try to flank Player from behind. I’ve implemented ITraversalProvider that increases Penalty for nodes close and in front of Player.
Here’s the code how I’m setting up path for agent:
var path = ABPath.Construct(npcPos, flankPos); // flankPos is position behind the player // path traversal which increases traversal cost when node is close to player and in front of them path.traversalProvider = new AvoidPlayerFrontTraversalProvider(playerPos, npcPos); //.. ai.SetPath(path); // ai is RichAI instance from GameObject
I’ve noticed that when path is set, RichAI agent calculates path properly (respecting ITraversalProvider), as I can see it in play mode with gizmos drawn. However, despite that, it still prefers to use shortest path possible, completely ignoring path with traversal provider.
Is there a possibility to force RichAI agent to respect this path without some hacks?
I’ve tried also to disable autoRepath, to check if it is not forcing recalculations, but it didn’t help.