Is there a way to have a NavModifierVolume switch its NavArea class in-game? Say, from NavArea_Default to NavArea_Null?
You can, but it requires setting “Rebuild At Runtime” flag (navigation preferences config). For example:
void ANavModifierVolume::UpdateNavArea(TSubclassOf<class UNavArea> NewAreaClass)
{
AreaClass = NewAreaClass;
UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
if (NavSys)
{
NavSys->UpdateNavOctree(this, UNavigationSystem::OctreeUpdate_Modifiers);
}
}
It’s possible to get it working on static navmesh as well, but you would need to modify FPImplRecastNavMesh class to search for all navmesh polys in given shape, switch their area Id and hope that there aren’t any overlaps with other modifiers (multiple influences, cost sorting, etc).