Adjusting navmesh resolution
If you for example need to have one part of the navmesh higher detail than other parts.
Available in Unreal Engine 5.3 https://docs.unrealengine.com/5.3/en-US/navigation-mesh-resolutions-user-guide/
Get NavigationSystem in C++
auto NavSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
Events
OnNavigationGenerationFinishedDelegate
: Runs whenever navmesh is regenerated, this includes things like when NavArea data is changed for navlinks or other things
Querying
Querying from C++ requires FNavAgentProperties. Pawns and such have them, but if you want to get them by agent name (such as how it’s defined in project settings), you can instead use FNavDataConfig which extends it.
auto* NavSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
const FNavDataConfig* NavDataConfig = NavSystem->GetSupportedAgents().FindByPredicate([this](const FNavDataConfig& NavDataConfig)
{
return NavDataConfig.Name == DesiredAgentName;
});
Common issues
- Actors that use navigation should have “can ever affect navigation” turned off. If turned on, this can cause erratic behavior especially on dynamic navmeshes.
Implementation notes on recast-related classes
GatherNavigationDataGeometry
seems to pull values out of the nav relevant interface
FRecastTileGenerator::PrepareGeometrySources
collects the NavigationRelevantData
list which is used to generate the obstacles used in the navmesh. This method is virtual.
It seems the generator has a “parent generator” FRecastNavMeshGenerator
which provides some functionality like telling it whether to generate for a given tile
FRecastNavMeshGenerator
spawns the FRecastTileGenerator
in ConstructTileGeneratorImpl
where it passes itself as the parent
ARecastNavMesh
creates FRecastNavMeshGenerator
in CreateGeneratorInstance
which, is overridable
include recast.h
error: need Navmesh
in build.cs deps, not just NavigationSystem