How do you disable/enable NavMesh using NavModifierVolume with triggers

Heya :slight_smile:

I’ve got a case where I want to be able to disable/enable the NavMesh in certain areas with a triggerbox, but I’m having a bit of trouble getting it working. The initial state will have the NavMesh in this area start off disabled and then change to become active upon being triggered.

I’ve tried setting up a NavModifierVolume, setting it’s starting AreaClass to NavArea_Null. Then setting up a level blueprint triggering a Set Area Class where it’s set to have None/NavAreaDefault with the NavModifierVolume being referenced as the target. However this doesn’t seem to work, and I’ve been unable to find anyone else having issues with this here.

It is possible to get rid of the blocking NavModifierVolume by using Destroy Actor on it instead, but I kinda want to be able to enable it as well.

Cheers,

-Mazy

I was about to suggest runtime setting navigation area class of the volume, but I just confirmed what you report that it doesn’t work. It’s a bug and I’m going to fix it ASAP. Unfortunately other then that I don’t have a way to toggle big chunks of navmesh :confused:

But do you really need that? Why? Can you explain why you need that? It’s usually enough to just remove connections on navmesh, so that the “disabled” part is simply unreachable. Can you explain why this wouldn’t work for you?

Cheers,

–mieszko

Ah aight, thanks.

It’s for a test I’m mocking up where I essentially want to block AI characters from running through liquids/areas at certain times, the idea being that I’d enable/disable the navmodifiervolume in the areas with the liquids to do this. What do I have to do to remove connections on the navmesh? If that’ll work for this scenario then I’m all ears :wink:

I wanted to suggest using BlockingVolumes but it turns out in 4.7 this doesn’t work neither :confused: Already fixed for 4.8, but its shipping in like a month from now.

So I’ve spend a moment looking for a workaround and the only thing I could find is BlockingVolume scaling. You need to put a “high” blocking volume on the area you want to cut off. Make sure the root location is above where AI heads will be. Then if you want to “open” the are you scale the volume in Z axis to something really small. This will get applied to navmesh. Scaling back will work as well.

You won’t need this hack in 4.8, but like I said, it’s still a way off. I’m terribly sorry!

Let me know if you encounter issues with this hack-approach.

Hehe that’s alright, knowing that it’s being worked on is good to hear :slight_smile:

I’ll try out the workaround with the BlockingVolumes, or perhaps try moving them up in the Z axis (that would work as well in this test scene, tho I guess scaling would work just as well).

I suggested scaling because moving won’t work :smiley:

Does this mean a solution where we switch between two different NavigationQueryFilters won’t work either ?

Okay so I actually managed to get that to work for our part. I created a new type of NavArea which was traversable by default and made a NavigationQueryFilter in which we exclude the new NavArea.

Then it is simply a matter of switching between those two filters.