Vixen
02b45cc4
csharp
public sealed class Crowd

Agents that follow paths across a NavMesh and stay out of each other's way.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Four things happen to an agent every update, in this order: it is given a path if it asked for one, it works out which way it would like to go, it is talked out of that by whoever is in the way, and it is moved — across the surface, so that whatever the previous three steps decided, it ends the frame standing somewhere it could have walked to.

That last step is the invariant worth stating on its own: an agent cannot leave the mesh. Steering and avoidance produce a wish, and MoveAlongSurface is what turns the wish into a position. A bug in avoidance makes an agent walk oddly; it cannot make one walk through a wall.

Pathfinding is the expensive part and is done only when something changed — a new destination, or a move that ended outside the corridor. Steering is a string-pull over the corridor and costs a few microseconds; that is what runs every frame for every agent.

Fields and properties (9)

  • public NavMesh Mesh

    The mesh the agents walk on.

  • public NavMeshQuery Query

    The query the crowd plans and moves with.

  • public NavQueryFilter Filter

    Which polygons the agents may use.

  • public int MaxPathLength

    The longest corridor an agent may hold.

  • public NavPathQueue Paths

    Where the searches happen, a slice at a time.

  • public int PathIterationsPerUpdate

    How many polygon expansions the queue may do per update, across every search in flight.

  • public int AgentCount

    How many agents there are.

  • public Vector3 SearchExtents

    How far off the mesh a position may be and still be found on it.

  • public Crowd.AgentEnumerator Agents

    Every live agent, for a caller that wants to walk them — a debug view, a save.

Methods (12)

Used by (12)

  • CrowdBenchmarksVixen.Benchmarks.Navigation
  • AgentEnumeratorVixen.Navigation
  • CrowdRetargetTestsVixen.Navigation.Tests
  • CrowdTestsVixen.Navigation.Tests
  • NavMeshDebugDrawVixen.Navigation
  • NavMeshDebugDrawTestsVixen.Navigation.Tests
  • NavPathQueueJobTestsVixen.Navigation.Tests
  • NavPathQueueTestsVixen.Navigation.Tests
  • NavigationAllocationTestsVixen.Navigation.Tests
  • NavigationSystemVixen.Navigation
  • NavigationSystemTestsVixen.Navigation.Tests
  • OffMeshConnectionTestsVixen.Navigation.Tests