What is benefit of "GridPathAiController"?

So I am working with ai and grids and i see there is a “GridPathAIController” class for the AI Controller. I would assume it has built in logic for grids then. I can not for the life of me find any real documentation on this controller class and how to use it correctly. and what grids does it use? are you able to import grids? Any insight on how this controller class works would be amazing.

Thank you.

Hi, I’ve never used it, but from looking at its source code, the only thing it does is replace the default path following component with UGridPathFollowingComponent.

And the remarks in the doc there (UGridPathFollowingComponent | Unreal Engine Documentation) are:

Path following augmented with local navigation grids

Keeps track of nearby grids and use them instead of navigation path when agent is inside. Once outside grid, regular path following is resumed.

This allows creating dynamic navigation obstacles with fully static navigation (e.g. static navmesh), as long as they are minor modifications for path. Not recommended for blocking off entire corridors.

Does not replace proper avoidance for dynamic obstacles!

So I guess the benefit there is:

This allows creating dynamic navigation obstacles with fully static navigation (e.g. static navmesh), as long as they are minor modifications for path.


And the grids seem to be handled by UNavLocalGridManager (UNavLocalGridManager | Unreal Engine Documentation).

2 Likes

sorry for the late response. Thank you for your reply. How would i access these grids or assign a grid?

I never used it, so I can’t really help you there. Some of its functions are exposed to blueprint (e.g. Add Local Navigation Grid for Point | Unreal Engine Documentation). Otherwise you could look at the source code for the UNavLocalGridManager.

I’m working on the same problem and I’ve narrowed it down for you.

The UGridPathFollowingComponent class already contains a local pointer to UNavLocalGridManager named GridManager. Its set in the Initialize() function:

GridManager = UNavLocalGridManager::GetCurrent(this);

Epic often uses this GetCurrent(this) static call for their manager stuff. I assume the Grid Manager is one of these.

So you can communicate with the GridManager using that property or by your own reference to UNavLocalGridManager::GetCurrent(this). Because its the same static call, it returns the same static instance, so its like a global object.