Dynamic modifications to NavMesh properties and cost

I have recently started exploring the capabilities of what is exposed in UE4’s navigation system interface and Recast. One my goals is to discern whether the capability to modify the area cost and entry cost of NavMesh Polygons during run-time exists.

For example, let’s say a character has a flashlight and, when this flashlight is turned on, certain AI characters should either benefit or be hindered by updated properties of nav mesh polygons (similar to how a NavModifier Volume and NavAreas changed the properties when the nav mesh is generated). The light would be encapulated by either a cone or a combination of simple collision volumes. Ideally, these collision volumes could be projected onto the nav mesh to modify the area properties. I realize this might be quite performance intensive. Ideally, this operation could be done periodically (amortize the pain) or even asynchronously.

From preliminary investigations, I haven’t been able to identify any exposed functionality that would accomplish this. It appears that NavModifier Volumes only update NavMesh when it is generated in the editor. This is also true for the NavModifierComponent.

I thought about using NavQueryFilters that could change during runtime but that is only sufficient with lights whose location would never change during the course of a game session.

I’ve read through the solutions presented here Modify pathfinding cost - DetourNavMeshQuery subclass - World Creation - Epic Developer Community Forums . Solution three looks like it presents the most potential. However, I don’t really want to change how the pathfinding cost is determined. What I really want to do is modify the properties of the nav mesh areas/polygons while still using the existing pathfinding cost algorithm.

Is there any kind of dynamic run-time modifier to the nav mesh available at this time? If not, where might be the best place to start for extending existing functionality to create one.

2 Likes

Hello. Did you find solution? I’m trying to find the answer to the same questions. I want to set a new cost to selected segments of navmesh. Like nav Modifier volume but in real time. And I want to visualise it (by color or with any other method).

Hello. Did you find solution? I’m trying to find the answer to the same questions. I want to set a new cost to selected segments of navmesh. Like nav Modifier volume but in real time. And I want to visualise it (by color or with any other method).

If you have a dynamic navmesh, both work at runtime. When you want a flash light, here is what you can try. Create a QueryFilter for the lit area; create a nav modifier volume with a cone brush, and attach it to your flash light, especially the direction is important. The lenght should go through your geometry, the clipping is what modifies the nav mesh. And that should be it.
It could be rough on performance when you wiggle around the flash light to quickly, but there should be ways to manually apply the modifier volume to the nav mesh.