class

NavAgentSystem

Steers every NavAgentComponent toward its destination each frame.

Module
AINavigation
Header
#include "AINavigation/NavAgentSystem.h"
Namespace
Mowo

Three operating modes, picked automatically based on what's available:

  1. NavMesh + dtCrowd (preferred): one dtCrowd manages every agent. Avoidance, anticipation, and separation are handled by Detour. Per-tick we feed destinations in and read back positions — agents push around each other instead of overlapping.

  2. NavMesh, no crowd (initialization failure path): fall back to single-agent Detour findPath + findStraightPath path-follow. No agent-to-agent avoidance.

  3. No NavMesh: straight-line steering at agent.speed, ignoring everything. Same behavior the Scope-A skeleton had — keeps the system functional in unbaked scenes.

Type aliases

AliasDescription
using FSmartLinkHandler = std::function<void(const FSmartLinkEvent&)>

Constructors

SignatureNameDescription
~NavAgentSystem() override~NavAgentSystem

Public functions

ReturnsNameDescription
boolDeclaresComponentAccessWrites TransformComponent (direct steering + facing), so it serializes against every other Transform producer — that ordering is the point of declaring.
ComponentMaskGetReadMask
ComponentMaskGetWriteMask
uint32_tGetResourceWriteMaskA dtNavMeshQuery carries its own search state, so a path query is a write.
voidInitialize
voidShutdown
voidUpdate
voidSetNavMeshWired by Scene::SetNavMesh on bake / load / clear.
Ref<NavMeshAsset>GetNavMesh
Ref<NavMeshAsset>GetNavMeshForAgentThe navmesh baked for this agent's size: its Agent Type by name, else the smallest baked radius it fits, else the widest.
size_tGetCrowdLaneCount
floatQueryPathLengthLength of the nav path from start to end along its waypoints, or a negative number when there is no nav mesh or no path — what an environment query's Pathfind test measures.
boolProjectPointNearest navmesh point under/over point: within half a metre horizontally and verticalExtent vertically.
voidCollectReachablePointsCentres of the polygons reachable from center within radius of path cost (Dijkstra over the navmesh), at most maxPoints of them.
uint32_tRequestPathAsync
uint32_tRequestPathAsync
EPathRequestStateTakePathResultReady or Failed hands the result over (waypoints for Ready) and forgets the request; Pending leaves it queued; Unknown = no such request.
voidCancelPathRequest
uint32_tProcessPathRequestsOne budgeted pass over the queue; returns the search iterations spent.
uint32_tGetPendingPathRequestCount
uint32_tAddSmartLinkHandler
voidRemoveSmartLinkHandler
const std::vector<FSmartLinkEvent>&GetSmartLinkEvents
voidSyncLinks
size_tGetStreamedTileCount
size_tGetResidentStreamedTileCount
int32_tAcquireFilterSlot

Function details

C++
~NavAgentSystem() override

DeclaresComponentAccess

C++
bool DeclaresComponentAccess() const override

Writes TransformComponent (direct steering + facing), so it serializes against every other Transform producer — that ordering is the point of declaring.

GetReadMask

C++
ComponentMask GetReadMask() const override

GetWriteMask

C++
ComponentMask GetWriteMask() const override

GetResourceWriteMask

C++
uint32_t GetResourceWriteMask() const override

A dtNavMeshQuery carries its own search state, so a path query is a write.

Initialize

C++
void Initialize(World* world) override

Shutdown

C++
void Shutdown() override

Update

C++
void Update(float deltaTime) override

SetNavMesh

C++
void SetNavMesh(Ref<NavMeshAsset> nav)

Wired by Scene::SetNavMesh on bake / load / clear. Rebuilds the dtCrowd whenever the underlying nav mesh changes — every agent re-adds itself on the next Update tick.

GetNavMesh

C++
Ref<NavMeshAsset> GetNavMesh() const

GetNavMeshForAgent

C++
Ref<NavMeshAsset> GetNavMeshForAgent(const NavAgentComponent& agent) const

The navmesh baked for this agent's size: its Agent Type by name, else the smallest baked radius it fits, else the widest. The primary mesh when the scene carries no agent variants.

GetCrowdLaneCount

C++
size_t GetCrowdLaneCount() const

QueryPathLength

C++
float QueryPathLength(const Vec3& start, const Vec3& end)

Length of the nav path from start to end along its waypoints, or a negative number when there is no nav mesh or no path — what an environment query's Pathfind test measures.

ProjectPoint

C++
bool ProjectPoint(const Vec3& point, float verticalExtent, Vec3& outProjected)

Nearest navmesh point under/over point: within half a metre horizontally and verticalExtent vertically. False when no polygon is there — the point hangs in the air or sits inside a wall.

CollectReachablePoints

C++
void CollectReachablePoints(const Vec3& center, float radius, int32_t maxPoints, std::vector<Vec3>& out)

Centres of the polygons reachable from center within radius of path cost (Dijkstra over the navmesh), at most maxPoints of them.

RequestPathAsync

C++
uint32_t RequestPathAsync(const Vec3& start, const Vec3& end, int32_t priority = 0)

RequestPathAsync

C++
uint32_t RequestPathAsync(const Vec3& start, const Vec3& end, int32_t priority, const FNavQueryFilterSpec& filter)

TakePathResult

C++
EPathRequestState TakePathResult(uint32_t requestId, std::vector<Vec3>& outWaypoints)

Ready or Failed hands the result over (waypoints for Ready) and forgets the request; Pending leaves it queued; Unknown = no such request.

CancelPathRequest

C++
void CancelPathRequest(uint32_t requestId)

ProcessPathRequests

C++
uint32_t ProcessPathRequests(uint32_t iterationBudget)

One budgeted pass over the queue; returns the search iterations spent. Update calls it with the cvar budget; public so a driver can run the queue on its own clock.

GetPendingPathRequestCount

C++
uint32_t GetPendingPathRequestCount() const

AddSmartLinkHandler

C++
uint32_t AddSmartLinkHandler(FSmartLinkHandler handler)

RemoveSmartLinkHandler

C++
void RemoveSmartLinkHandler(uint32_t handle)

GetSmartLinkEvents

C++
const std::vector<FSmartLinkEvent>& GetSmartLinkEvents() const
C++
void SyncLinks()

GetStreamedTileCount

C++
size_t GetStreamedTileCount() const

GetResidentStreamedTileCount

C++
size_t GetResidentStreamedTileCount() const

AcquireFilterSlot

C++
static int32_t AcquireFilterSlot(std::vector<FNavQueryFilterSpec>& slots, const FNavQueryFilterSpec& spec, int32_t maxSlots)
Generated from AINavigation/NavAgentSystem.h via ainavigation.json · Oct 27, 2026Version 1.0.0