Ignore a specific nav area while pathfinding

Is there a way for the navigation pathfinding system to ignore a specific area (not an entire nav area class, only the area defined by a specific box collision/volume)?

The problem is, that I have pawns (not characters, they are tanks, can’t map their collision to a capsule) that should be able to navigate around other pawns on the navmesh. The pawns are using a path generated by the Find Path to Location Synchronously that they follow.

The problem is, that the path finding has a very flip-flopy behaviour, when there is an obstacle (or null area) around the pawn, since I am using the pawn’s location as the starting point for the path finding query as well as the centerpoint for the navigation modifying collision volume. The pawn tends to just turn around and flip-flop between paths, which get recalculated as the pawn (and the area around it) rotates and translates.

I could theoretically not use the center of the pawn for path finding, but I am not sure how I would pick a starting location for the pathfinding query.

I considered using the crowd AI controller, but that is intrinsically tied to a character and a capsule collision. I was unable to utilize the character class, since it’s movement model is different to that of a tracked tank (tanks don’t turn around instantly, can only go forward or backward)

Is there a way to override a c++ class of some kind, that would allow me to ignore a specific area/navigation affecting volume on the navmesh?

1 Like

Is there a way for the navigation pathfinding system to ignore a specific area (not an entire nav area class, only the area defined by a specific box collision/volume)?

No, unless you use ‘virtual’ filters that will allow you to manually filter every navmesh polygon.

I could theoretically not use the center of the pawn for path finding, but I am not sure how I would pick a starting location for the pathfinding query.

You need your tanks to implement the INavAgentInterface interface. The GetNavAgentLocation result is being used as pathfinding start location.

I considered using the crowd AI controller, but that is intrinsically tied to a character and a capsule collision. I was unable to utilize the character class, since it’s movement model is different to that of a tracked tank (tanks don’t turn around instantly, can only go forward or backward)

Have you considered/tried using our RVO implementation? You need to set bUseRVOAvoidance to true (it’s both on character and wheeled movement component). Might be enough.

Is there a way to override a c++ class of some kind, that would allow me to ignore a specific area/navigation affecting volume on the navmesh?

Yeah, that’s the virtual filter. To use it you need to extend the RecastNavMesh class and use your extension as game’s navmesh (use Project Settings > Navigation System > Supported Agents to configure it). Then, that class would have to create a new default query filter - see ARecastNavMesh::RecreateDefaultFilter for details. You’ll need to extend FRecastQueryFilter and implement passVirtualFilter (which is inherited from dtQueryFilter). Make sure your filter is created as ‘virtual’ (dtQueryFilter::isVirtual). That should get you going.

Cheers,

–mieszko

Thanks for your answer.

You need your tanks to implement the INavAgentInterface interface. The GetNavAgentLocation result is being used as pathfinding start location.

I am not using a movement component, I just fake user input to turn/go forward towards each path point returned by the Find Path To Location node, where one can specify start location to whatever. At least it worked that way for me.

Have you considered/tried using our RVO implementation? You need to set bUseRVOAvoidance to true (it’s both on character and wheeled movement component). Might be enough.

Character movement component is unavailable for pawns as a component and vehicle wheeled movement component requires a lot of configuration, including defining wheels and a ton of other things, and I never got it to work properly.

I’ll look into the virtual filter overriding. Though I have to say, it is quite unfortunate, that the entire navigation system is built around characters and capsule-shaped agents. I have spent a month trying to implement a satisfying RTS unit movement, but I have not come close to something that would be acceptable.

In any case, thank you for your time.

Hello! I’m in exactly the same situation as you! I’m excluding areas around pawns from the navmesh (actually setting navmodifier, but that has almost the same effect). After this a pawn can sussceffully find path around other pawns, but it starts the way with very bad points (since it itself surrounded with unwalkable region).
Have you found proper solution so far?