Tutorial 09 - Hybrid LCM Nav3D + Recast crowd avoidance
TL;DR: Add ULcmCrowdAvoidanceBridge to
your LCM Nav3D flying pawn → stock UE5 UCrowdManager Detour
RVO sees the LCM Nav3D pawn and steers Recast crowd agents around it.
The Z-band filter (auto-applied by the bridge) prevents false-collision
avoidance between agents at different vertical bands.
Prerequisites
- The third-person template (or any project with a Character + AIController).
- LCMNav3D plugin enabled.
- An
ALcmNavigationManagerSVOin the level. - An
ALcmFlyingPawn(or your own LCM Nav3D flying pawn).
Step 1 - Add the bridge to your LCM Nav3D pawn
In the editor, select your LCM Nav3D pawn → Add Component → search "LCM Crowd Avoidance Bridge".
Defaults are sensible:
bAutoRegister = true- registers withUCrowdManageron BeginPlay automaticallyAgentRadius = 50 cm- typical pawn radiusAgentHalfHeight = 100 cm- cylinder extent for DetourMaxSpeed = 800 cm/s- matchesULcmNavMovementComponentdefault
That's it for the LCM Nav3D side.
Step 2 - Add Recast crowd agents (existing UE5 pattern)
Your Recast ground crowd agents should already use
UCrowdFollowingComponent instead of the default
UPathFollowingComponent. This is the standard UE5 setup for
any project using crowd avoidance - LCM Nav3D doesn't change this. If
you're not already on UCrowdFollowingComponent:
// In your AAIController subclass constructor
GetCharacterMovement()->bUseAccelerationForPaths = true;
//. and override the AIController to use UCrowdFollowingComponent
Or in Blueprint: the AIController's
UCrowdFollowingComponent is auto-registered as the
agent.
Step 3 - Play
Hit Play. Your LCM Nav3D flying pawn and Recast ground crowd agents now avoid each other (per the Z-band filter rules below).
How the Z-band filter works
Unreal's UCrowdManager Detour RVO assumes
coplanar agents - out of the box, a flying LCM Nav3D agent at
Z=500 would be flagged as a "neighbour" by a Recast ground agent at Z=0,
producing avoidance behaviour that looks like the ground agent dodging
an obstacle 5 meters overhead.
The bridge fixes this at the avoidance-group bitfield level:
- Each agent gets an
AvoidanceGroupbit derived from its world Z divided byr.LcmNav.Crowd.ZBandHeightCm(default 200 cm). - Each agent's
GroupsToAvoidis set to its own band + the ±1 adjacent bands (so vertically close agents still see each other). - Cross-band agents (e.g. ground Z=0 and aerial Z=500 with 200 cm bands → bands 0 and 2) ignore each other via Detour's standard bitfield mask.
Same engineering work, leverages stock Detour rather than fighting it.
Tuning
r.LcmNav.Crowd.ZBandHeightCm
| Use case | Recommended value |
|---|---|
| Default (typical pawn-height scenes) | 200 |
| Low-ceiling interior (1.5m floors) | 150 |
| Vertical skyscraper (need fine-grained per-floor separation) | 100 |
| Open sky (most LCM Nav3D traffic is far above ground) | 400 |
| Disable filter (legacy Detour coplanar behaviour) | 0 |
Set the CVar in PIE to live-tune, then commit to your project's
DefaultEngine.ini once you're happy.
Stacked multi-floor scenarios
UCrowdManager is one global instance per world. For
stacked-floor scenarios (e.g. LCM Nav3D agents at Z=200, 500, 800
sharing the same UCrowdManager), the Z-band filter handles it
automatically - each pair of agents whose Z-distance is > 1
band-height ignores each other.
For truly independent crowds (each floor should be
its own crowd zone), you'd need to spawn separate
UCrowdManager instances per zone via project-side
subclassing. This is out of scope for v1.
Performance notes
- Each registered LCM Nav3D bridge contributes ~1
RegisterAgentcall at BeginPlay + ~7 virtual-call evaluations per Detour tick (Detour reads the ICrowdAgentInterface getters once per query). - The Z-band filter eliminates ~99% of cross-band RVO computation cost - only agents within ±1 band of you contribute to your avoidance solve.
- Disabling the filter (
r.LcmNav.Crowd.ZBandHeightCm = 0) restores legacy Detour coplanar behaviour for benchmarking.
Acceptance test (manual)
- Spawn 5 Recast ground crowd agents in a circle at Z=0.
- Spawn 1 LCM Nav3D flying pawn with
ULcmCrowdAvoidanceBridgeat Z=500. - Fly the LCM Nav3D pawn through the middle of the ground-agent circle.
- Expected: ground agents continue their pathing without dodging the airborne pawn (Z-band separation > 200cm default).
- Now fly the LCM Nav3D pawn down to Z=100 - ground agents dodge it.
If step 4 fails (ground agents dodge the airborne pawn), check
r.LcmNav.Crowd.ZBandHeightCm is not 0.
What about the LCM Nav3D pawn's own avoidance?
Two paths, both work:
LCM Nav3D CBS/ORCA (default, the FlyTo task's built-in steering): the LCM Nav3D pawn avoids Recast crowd agents via the existing CBS context. Detour Crowd is purely the publishing surface to the rest of the world.
Use UCrowdFollowingComponent on the LCM Nav3D pawn: replace the LCM Nav3D pawn's AIController's
UPathFollowingComponentwithUCrowdFollowingComponent. The pawn becomes a full Detour Crowd participant - receives the suggested-velocity from Detour and applies it through its movement component. Combine withULcmNavMovementComponentfor the locomotion side.
Path 1 is the default; Path 2 is for projects that want a uniform crowd avoidance solver across LCM Nav3D and Recast agents.
Mass variant
The Mass-Entity equivalent
(UApexCrowdMassBridgeProcessor) ships with T26 Mass Entity
work - not yet available.
Related LCM Nav3D surfaces
LCM_BTTask_FlyTo- already has CBS+ORCA built-in for LCM Nav3D-internal avoidanceLCM_BTTask_EvadeCBS- pure-defensive evade using the same CBS contextULcmNavMovementComponent- LCM Nav3D-aware flying-pawn movement component