How would I limit a nav link proxy which is using my custom Area Class to a certain AI agent?
I’ve added another Supported Agent to the DefaultEngine config, which I set on the Nav Link, but I don’t understand how I associate a particular agent with that Supported Agent entry.
I also saw that you can place volumes which will exclude areas, but I’d definitely prefer not to have to place both the nav links and the volumes.
Thanks!
Sorry for delayed response.
You can’t do it directly in navlink proxy, but each navigation area have SupportedAgents property. If you set up a link with an area that supports only agent A, it won’t be created on agent B’s navmesh.
NavModifier volumes follow the same principle: area will be created on navmesh only if area allows it. Otherwise modifier will be ignored.
OK, but I’m still confused as to how I match a particular agent (my custom Bot) to a particular Supported Agent entry. Does that make sense, or am I not understanding how it should work?
Sorry, I misunderstood you. If you want to limit area/navlink usage in pathfinding for single/group of AIs, it’s best to use navigation filters.
- Make area unwalkable by default in c++ constructor (e.g. DefaultCost set to DT_UNWALKABLE_POLY_COST = FLT_MAX)
- Make new NavigationQueryFilter (native or blueprint) and set TravelCostOverride to some value (e.g. default = 1)
- Use this filter for AI’s move requests, either as a parameter in move task or directly in AIController by overriding PreparePathfinding() to modify returned Query.QueryFilter.
Alternatively you can have area walkable for everyone and unwalkable with filter, or use AreaFlags instead of costs.
Thanks for the response Lukasz, it sounds like that’s what I need. Haven’t had a chance to implement it yet, but I’ll let you know how it goes.
That worked great by the way. Ended up doing it in PreparePathfinding. Thanks again!