Recast Navigation
Navigation-mesh Toolset for Games
|
Members in this module implement local steering and dynamic avoidance features. More...
Classes | |
struct | dtCrowdNeighbour |
Provides neighbor data for agents managed by the crowd. More... | |
struct | dtCrowdAgentParams |
Configuration parameters for a crowd agent. More... | |
struct | dtCrowdAgent |
Represents an agent managed by a dtCrowd object. More... | |
class | dtCrowd |
Provides local steering behaviors for a group of agents. More... | |
class | dtPathCorridor |
Represents a dynamic polygon corridor used to plan agent movement. More... | |
Enumerations | |
enum | CrowdAgentState { DT_CROWDAGENT_STATE_INVALID , DT_CROWDAGENT_STATE_WALKING , DT_CROWDAGENT_STATE_OFFMESH } |
The type of navigation mesh polygon the agent is currently traversing. More... | |
enum | UpdateFlags { DT_CROWD_ANTICIPATE_TURNS = 1 , DT_CROWD_OBSTACLE_AVOIDANCE = 2 , DT_CROWD_SEPARATION = 4 , DT_CROWD_OPTIMIZE_VIS = 8 , DT_CROWD_OPTIMIZE_TOPO = 16 } |
Crowd agent update flags. More... | |
Functions | |
dtCrowd * | dtAllocCrowd () |
Allocates a crowd object using the Detour allocator. More... | |
void | dtFreeCrowd (dtCrowd *ptr) |
Frees the specified crowd object using the Detour allocator. More... | |
Variables | |
static const int | DT_CROWDAGENT_MAX_NEIGHBOURS = 6 |
The maximum number of neighbors that a crowd agent can take into account for steering decisions. More... | |
static const int | DT_CROWDAGENT_MAX_CORNERS = 4 |
The maximum number of corners a crowd agent will look ahead in the path. More... | |
static const int | DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS = 8 |
The maximum number of crowd avoidance configurations supported by the crowd manager. More... | |
static const int | DT_CROWD_MAX_QUERY_FILTER_TYPE = 16 |
The maximum number of query filter types supported by the crowd manager. More... | |
Members in this module implement local steering and dynamic avoidance features.
The crowd is the big beast of the navigation features. It not only handles a lot of the path management for you, but also local steering and dynamic avoidance between members of the crowd. I.e. It can keep your agents from running into each other.
Main class: dtCrowd
The dtNavMeshQuery and dtPathCorridor classes provide perfectly good, easy to use path planning features. But in the end they only give you points that your navigation client should be moving toward. When it comes to deciding things like agent velocity and steering to avoid other agents, that is up to you to implement. Unless, of course, you decide to use dtCrowd.
Basically, you add an agent to the crowd, providing various configuration settings such as maximum speed and acceleration. You also provide a local target to more toward. The crowd manager then provides, with every update, the new agent position and velocity for the frame. The movement will be constrained to the navigation mesh, and steering will be applied to ensure agents managed by the crowd do not collide with each other.
This is very powerful feature set. But it comes with limitations.
The biggest limitation is that you must give control of the agent's position completely over to the crowd manager. You can update things like maximum speed and acceleration. But in order for the crowd manager to do its thing, it can't allow you to constantly be giving it overrides to position and velocity. So you give up direct control of the agent's movement. It belongs to the crowd.
The second biggest limitation revolves around the fact that the crowd manager deals with local planning. So the agent's target should never be more than 256 polygons aways from its current position. If it is, you risk your agent failing to reach its target. So you may still need to do long distance planning and provide the crowd manager with intermediate targets.
Other significant limitations:
enum CrowdAgentState |
The type of navigation mesh polygon the agent is currently traversing.
enum UpdateFlags |
Crowd agent update flags.
Enumerator | |
---|---|
DT_CROWD_ANTICIPATE_TURNS | |
DT_CROWD_OBSTACLE_AVOIDANCE | |
DT_CROWD_SEPARATION | |
DT_CROWD_OPTIMIZE_VIS | Use dtPathCorridor::optimizePathVisibility() to optimize the agent path. |
DT_CROWD_OPTIMIZE_TOPO | Use dtPathCorridor::optimizePathTopology() to optimize the agent path. |
dtCrowd* dtAllocCrowd | ( | ) |
Allocates a crowd object using the Detour allocator.
void dtFreeCrowd | ( | dtCrowd * | ptr | ) |
Frees the specified crowd object using the Detour allocator.
[in] | ptr | A crowd object allocated using dtAllocCrowd |
|
static |
The maximum number of crowd avoidance configurations supported by the crowd manager.
|
static |
The maximum number of query filter types supported by the crowd manager.
|
static |
The maximum number of corners a crowd agent will look ahead in the path.
This value is used for sizing the crowd agent corner buffers. Due to the behavior of the crowd manager, the actual number of useful corners will be one less than this number.
|
static |
The maximum number of neighbors that a crowd agent can take into account for steering decisions.