Several different NavMeshes for the same area?

Hey Guys,

Here’s the problem I have: imagine you’re working on a GTA-like game, where you’ve got pedestrians walking on sidewalks and cars navigating along roads. This, apparently, requires their two respective AIs to use two different NavMeshes for pathfinding.

Now, if a pedestrian or a car driver is in panic and is trying to escape or chase a target, they apparently need to drop their usual navigation limits and switch to a third NavMesh, which equally includes all terrain suitable for navigation – roads, sidewalks, lawns, gaps between buildings etc. So you’d need a third NavMesh for this purpose.

Now, I can’t seem to find a way to have 3 instances of NavMesh built for different types of navigation (for different sets of collision boxes for example) and stored simultaneously for further use.

Could you please give me any advice on how to pull this off? I’m a bit new to the AI and navigation aspects of UE4.

I’d prefer a blueprint solution, however, I could resort to C++ if there’s no other way.

Thanks in advance,
Best regards,
Alex

Cars and pedestrians probably need different navmeshes (because different radii), and that part’s straightforward: Just define a second agent type in the Navigation options, with a different radius.

For panicking pedestrians, though, the easiest thing is probably to give the “only when you’re panicking” areas their own NavArea. Then, you blueprint a NavigationQueryFilter which rejects those areas. Then, when invoking pathfinding (MoveTo etc.), pass that navigation filter if the character is not panicking, and pass no filter if they are.

1 Like

Thanks! This filter seems like what I need, I’ll try using it!