Skip to content

t1k:unity:dots-nav:agents-navigation

FieldValue
Moduledots-nav
Version2.1.7
Efforthigh
Tools

Keywords: AI agents, DOTS, navigation, pathfinding

/t1k:unity:dots-nav:agents-navigation

Reference for Agents Navigation v4.4.4 + Crowds Extension v1.2.0 — a high-performance DOTS navigation system using continuum crowds for flow-field pathfinding, obstacle avoidance, and crowd steering.

Prerequisites: dots-ecs (IComponentData, ISystem, Baker) · dots-jobs-burst (Jobs, Burst, NativeContainers) Related skills: dots-rpg (RPG gameplay) · dots-physics (physics queries)


  • Adding Agent, AgentBody, AgentShape, AgentLocomotion components
  • Setting up NavMesh pathfinding (NavMeshPath, AgentNavMeshAuthoring)
  • Configuring avoidance: AgentSonarAvoid, AgentSeparation, AgentCollider, AgentReciprocalAvoid
  • Working with AgentSystemGroup and sub-groups
  • Setting up crowd navigation, flow-field pathfinding
  • Configuring CrowdSurface, CrowdGroup, CrowdObstacle
  • Using AgentCrowdPath for crowd-based steering
  • Working with CrowdFlow, CrowdWorld, potential fields
  • Implementing continuum crowds algorithm
  • Runtime crowd group assignment (CrowdGroupAssignmentSystem, TeamCrowdGroup)

PackageVersionContents
com.projectdawn.navigation4.4.4Base: Agent, AgentBody, AgentShape, AgentLocomotion, NavMesh pathing, avoidance, flocking
com.projectdawn.navigation.crowds1.2.0Extension: Continuum crowds, flow fields, surfaces, obstacles

ModuleReferenceKey Types
Base Packagebase-guide.mdAgent, AgentBody, AgentShape, AgentLocomotion, NavMeshPath, AgentSonarAvoid, AgentSeparation, FlockGroup
Crowds Corecrowds-guide.mdCrowdSurface, CrowdGroup, CrowdFlow, CrowdObstacle, CrowdDiscomfort, AgentCrowdPath

All crowd systems run inside SimulationSystemGroup:

CrowdSurfaceSystem (creates/destroys runtime worlds)
→ CrowdWorldSystem (splats obstacles, discomfort, density)
→ CrowdGoalSystem (updates goals from agent destinations)
→ CrowdFlowSystem (computes speed/cost/potential fields) [EXPENSIVE]
→ CrowdSteeringSystem (samples velocity, applies steering)
→ CrowdDisplacementSystem (maps agents to surface, ground constraint)

  • Agent: Required tag component; holds NavigationLayers for spatial filtering
  • AgentBody: Runtime state — Destination, Velocity, Force, RemainingDistance, IsStopped; call SetDestination(float3) or Stop()
  • AgentLocomotion: Motion config — Speed, Acceleration, AngularSpeed, StoppingDistance; replaces deprecated AgentSteering
  • AgentShape: Radius, Height, ShapeType (Circle=2D/Z-up, Cylinder=3D/Y-up)
  • NavMeshPath: IEnableableComponent; check HasFullPath/HasPartialPath; NavMeshNode buffer holds polygon ids
  • AgentSonarAvoid: Cone-based local avoidance; IEnableableComponent — toggle without removing
  • AgentSystemGroup: Runs in FixedStepSimulationSystemGroup (before physics) by default
  • AgentGrounding (DEPRECATED when using DOTS Physics): Classic physics RaycastCommand grounding — replace with a DOTS-based grounding system using CollisionWorld.CastRay(). Classic raycasts can’t see SubScene-baked PhysicsCollider components
  • CrowdSurface: Grid-based walkable area. Width×height cells determine resolution vs performance
  • CrowdGroup: Agents sharing same destination + speed. Minimize groups for performance
  • CrowdFlow: 3 fields per group — Cost, Speed, Potential (lower potential = attraction)
  • AgentCrowdPath: ISharedComponentData linking agent to crowd group entity
  • CrowdObstacle: Marks unwalkable cells (Quad/Circle shape)
  • CrowdDiscomfort: Soft avoidance zones agents prefer to avoid
  • CostWeights: Balance Distance, Time, Discomfort in pathfinding cost
  1. Create CrowdSurface: GameObject > AI > Crowd Surface
  2. Optionally bake: Create CrowdData asset, assign to surface, press Bake
  3. Create CrowdGroup: GameObject > AI > Crowd Group — assign surface reference
  4. Add AgentCrowdPathingAuthoring to agent prefabs — assign crowd group
  5. Add obstacles: GameObject > AI > Crowd Obstacle
LayerComponentRoleCost
Macro routingAgentCrowdPathFlow-field steering, density-awareO(grid²) shared
Steering-levelAgentSonarAvoidCone-based local avoidO(agents)
PhysicalAgentColliderSpatial-partitioned displacementO(log N)

Scale rules:

  • AgentSonarAvoid.Radius: use 1.0f for 2K+ units (default 2.0f causes ~4× overlap with dense crowds)
  • AgentCollider: IEnableableComponent, spatial-partitioned — NOT O(N²); safe to enable for all units
  • AgentReciprocalAvoid: O(N²) — avoid at scale; use AgentCollider + SonarAvoid instead

Prefabs can’t reference SubScene CrowdGroup GameObjects at bake time. Use runtime assignment:

// On CrowdGroup entity (SubScene):
public struct TeamCrowdGroup : IComponentData { public byte TeamId; }
// CrowdGroupAssignmentSystem (SimulationSystemGroup, runs after spawn):
// 1. Build NativeHashMap<byte, Entity>: TeamId → CrowdGroup entity
// 2. For each agent with AgentCrowdPath.Group == Entity.Null:
// em.SetSharedComponent(agent, new AgentCrowdPath { Group = groupMap[teamId] })

Gotcha: AgentCrowdPath.Group = Entity.Null until this system runs — agents default to no crowd steering. Gotcha: AgentCrowdPath is ISharedComponentData — setting it is a structural change; batch via ECB or direct EntityManager calls outside jobs.

Agents Navigation runs in FixedStepSimulationSystemGroup — minimize CrowdGroups (O(cells²) each), use static obstacles, batch destination changes, one CrowdSurface per arena. Disable AgentSonarAvoid for distant agents. Never use RaycastCommand for grounding — use CollisionWorld.CastRay().

→ See references/performance-guide.md for full rules, anti-patterns table (8 entries), common patterns, and DOTS Physics grounding code example.

-> See references/avoidance-ordering-guide.md for 3-layer avoidance pattern, navigation system ordering, and system ordering constraint gotchas.