engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
dtCrowd类 参考

Provides local steering behaviors for a group of agents. 更多...

#include <DetourCrowd.h>

Public 成员函数

int addAgent (const float *pos, const dtCrowdAgentParams &params, const dtQueryFilter *filter)
 Adds a new agent to the crowd. 更多...
 
int cacheActiveAgents ()
 Cache list of active agents 更多...
 
dtCrowdAgent ** getActiveAgents () const
 Gets all cached active agents
 
int getActiveAgents (dtCrowdAgent **agents, const int maxAgents)
 Gets the active agents int the agent pool. 更多...
 
const dtCrowdAgent * getAgent (const int idx)
 Gets the specified agent from the pool. 更多...
 
const dtCrowdAgentAnimation * getAgentAnims () const
 Gets all agent animations
 
const int getAgentCount () const
 The maximum number of agents that can be managed by the object. 更多...
 
dtQueryFilter * getEditableFilter (const int idx)
 Gets the filter used by the crowd. 更多...
 
const dtQueryFilter * getFilter (const int idx) const
 Gets the filter used by the crowd. 更多...
 
const dtProximityGrid * getGrid () const
 Gets the crowd's proximity grid. 更多...
 
const dtNavMeshQuery * getNavMeshQuery () const
 Gets the query object used by the crowd.
 
const dtObstacleAvoidanceParams * getObstacleAvoidanceParams (const int idx) const
 Gets the shared avoidance configuration for the specified index. 更多...
 
bool getObstacleAvoidancePattern (int idx, float *angles, float *radii, int *nsamples)
 [UE4] Gets the shared avoidance sampling pattern for the specified index. 更多...
 
const dtPathQueue * getPathQueue () const
 Gets the crowd's path request queue. 更多...
 
const float * getQueryExtents () const
 Gets the search extents [(x, y, z)] used by the crowd for query operations. 更多...
 
const dtSharedBoundary * getSharedBoundary () const
 Gets shared boundary cache
 
int getVelocitySampleCount () const
 Gets the velocity sample count. 更多...
 
bool init (const int maxAgents, const float maxAgentRadius, dtNavMesh *nav)
 Initializes the crowd. 更多...
 
bool initAvoidance (const int maxNeighbors, const int maxWalls, const int maxCustomPatterns)
 [UE4] Initializes the avoidance query. 更多...
 
bool isOutsideCorridor (const int idx) const
 [UE4] Check if agent moved away from its path corridor
 
void removeAgent (const int idx)
 Removes the agent from the crowd. 更多...
 
bool requestMoveTarget (const int idx, dtPolyRef ref, const float *pos)
 Submits a new move request for the specified agent. 更多...
 
bool requestMoveVelocity (const int idx, const float *vel)
 Submits a new move request for the specified agent. 更多...
 
bool resetAgentVelocity (const int idx)
 [UE4] Resets agent's velocity 更多...
 
bool resetMoveTarget (const int idx)
 Resets any request for the specified agent. 更多...
 
bool setAgentBackOnLink (const int idx)
 [UE4] Switch to offmesh link state 更多...
 
void setAgentCheckInterval (const float t)
 [UE4] Set time between attempts to restore agents state 更多...
 
bool setAgentCorridor (const int idx, const dtPolyRef *path, const int npath)
 [UE4] Set agent corridor, works only just after requesting move target when agent didn't start any pathfinding operations yet Use with caution! 更多...
 
bool setAgentWaiting (const int idx)
 [UE4] Switch to waiting state 更多...
 
void setEarlyReachTestOptimization (bool bEnable)
 [UE4]
 
void setObstacleAvoidanceParams (const int idx, const dtObstacleAvoidanceParams *params)
 Sets the shared avoidance configuration for the specified index. 更多...
 
void setObstacleAvoidancePattern (int idx, const float *angles, const float *radii, int nsamples)
 [UE4] Sets the shared avoidance sampling pattern for the specified index. 更多...
 
void setPathOffsetRadiusMultiplier (float RadiusMultiplier)
 [UE4] Set agent radius multiplier for offseting path from corners
 
void setPruneStartedOffmeshConnections (bool bRemoveFromCorridor)
 [UE4] Set offmesh connection pruning This will allow removing offmesh connection poly ref from corridor as soon as offmesh connection anim is triggered (default behavior)
 
void setSeparationFilter (float InFilter)
 [UE4] Set separation filter param
 
void setSingleAreaVisibilityOptimization (bool bEnable)
 [UE4] Set visibility optimization to use single area raycasts This will prevent from cutting through polys marked as different area which could have been avoided in corridor's path 更多...
 
void update (const float dt, dtCrowdAgentDebugInfo *debug)
 Updates the steering and positions of all agents. 更多...
 
bool updateAgentFilter (const int idx, const dtQueryFilter *filter)
 [UE4] Updates the specified agent's query filter. 更多...
 
void updateAgentParameters (const int idx, const dtCrowdAgentParams &params)
 Updates the specified agent's configuration. 更多...
 
void updateAgentState (const int idx, bool repath)
 [UE4] Refresh state of agent, used after completing movement through offmesh links 更多...
 
void updateStepAvoidance (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: avoidance 更多...
 
void updateStepCorridor (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: corridor updates at new position 更多...
 
void updateStepMove (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: integrate velocities and handle collisions 更多...
 
void updateStepNextMovePoint (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: next corner for move, trigger offmesh links 更多...
 
void updateStepOffMeshAnim (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: offmesh anims 更多...
 
void updateStepOffMeshVelocity (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: offmesh link velocity (instead of playing animation) 更多...
 
void updateStepPaths (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: path validity, path cache and path optimizations 更多...
 
void updateStepProximityData (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: neighbors and boundaries 更多...
 
void updateStepSteering (const float dt, dtCrowdAgentDebugInfo *debug)
 [UE4] Split update into several smaller components: steering 更多...
 

详细描述

Provides local steering behaviors for a group of agents.

成员函数说明

◆ addAgent()

int dtCrowd::addAgent ( const float *  pos,
const dtCrowdAgentParams &  params,
const dtQueryFilter *  filter 
)

Adds a new agent to the crowd.

参数
[in]posThe requested position of the agent. [(x, y, z)]
[in]paramsThe configutation of the agent.
[in]filter[UE4] query filter used by agent
返回
The index of the agent in the agent pool. Or -1 if the agent could not be added.

◆ cacheActiveAgents()

int dtCrowd::cacheActiveAgents ( )

Cache list of active agents

返回
The number of active agents

◆ getActiveAgents()

int dtCrowd::getActiveAgents ( dtCrowdAgent **  agents,
const int  maxAgents 
)

Gets the active agents int the agent pool.

参数
[out]agentsAn array of agent pointers. [(dtCrowdAgent *) * maxAgents]
[in]maxAgentsThe size of the crowd agent array.
返回
The number of agents returned in agents.

◆ getAgent()

const dtCrowdAgent * dtCrowd::getAgent ( const int  idx)

Gets the specified agent from the pool.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
返回
The requested agent.

◆ getAgentCount()

const int dtCrowd::getAgentCount ( ) const

The maximum number of agents that can be managed by the object.

返回
The maximum number of agents.

◆ getEditableFilter()

dtQueryFilter * dtCrowd::getEditableFilter ( const int  idx)

Gets the filter used by the crowd.

参数
[in]idx[UE4] The agent index. [Limits: 0 <= value < getAgentCount()]
返回
The filter used by the crowd.

◆ getFilter()

const dtQueryFilter * dtCrowd::getFilter ( const int  idx) const

Gets the filter used by the crowd.

参数
[in]idx[UE4] The agent index. [Limits: 0 <= value < getAgentCount()]
返回
The filter used by the crowd.

◆ getGrid()

const dtProximityGrid * dtCrowd::getGrid ( ) const
inline

Gets the crowd's proximity grid.

返回
The crowd's proximity grid.

◆ getObstacleAvoidanceParams()

const dtObstacleAvoidanceParams * dtCrowd::getObstacleAvoidanceParams ( const int  idx) const

Gets the shared avoidance configuration for the specified index.

参数
[in]idxThe index of the configuration to retreive. [Limits: 0 <= value < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]
返回
The requested configuration.

◆ getObstacleAvoidancePattern()

bool dtCrowd::getObstacleAvoidancePattern ( int  idx,
float *  angles,
float *  radii,
int *  nsamples 
)

[UE4] Gets the shared avoidance sampling pattern for the specified index.

参数
[in]idxThe index.
[in]anglesradians from direction of desired velocity [Count: nsamples]
[in]radiinormalized radii (0..1) for each sample [Count: nsamples]
[in]nsamplesThe number of samples
返回
true if pattern was found

◆ getPathQueue()

const dtPathQueue * dtCrowd::getPathQueue ( ) const
inline

Gets the crowd's path request queue.

返回
The crowd's path request queue.

◆ getQueryExtents()

const float * dtCrowd::getQueryExtents ( ) const
inline

Gets the search extents [(x, y, z)] used by the crowd for query operations.

返回
The search extents used by the crowd. [(x, y, z)]

◆ getVelocitySampleCount()

int dtCrowd::getVelocitySampleCount ( ) const
inline

Gets the velocity sample count.

返回
The velocity sample count.

◆ init()

bool dtCrowd::init ( const int  maxAgents,
const float  maxAgentRadius,
dtNavMesh *  nav 
)

Initializes the crowd.


参数
[in]maxAgentsThe maximum number of agents the crowd can manage. [Limit: >= 1]
[in]maxAgentRadiusThe maximum radius of any agent that will be added to the crowd. [Limit: > 0]
[in]navThe navigation mesh to use for planning.
返回
True if the initialization succeeded.

◆ initAvoidance()

bool dtCrowd::initAvoidance ( const int  maxNeighbors,
const int  maxWalls,
const int  maxCustomPatterns 
)

[UE4] Initializes the avoidance query.


参数
[in]maxNeighborsThe maximum number of processed neighbors
[in]maxWallsThe maximum number of processed wall segments
[in]maxCustomPatternsThe maximum number of custom sampling patterns
返回
True if the initialization succeeded.

◆ removeAgent()

void dtCrowd::removeAgent ( const int  idx)

Removes the agent from the crowd.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]

◆ requestMoveTarget()

bool dtCrowd::requestMoveTarget ( const int  idx,
dtPolyRef  ref,
const float *  pos 
)

Submits a new move request for the specified agent.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]refThe position's polygon reference.
[in]posThe position within the polygon. [(x, y, z)]
返回
True if the request was successfully submitted.

◆ requestMoveVelocity()

bool dtCrowd::requestMoveVelocity ( const int  idx,
const float *  vel 
)

Submits a new move request for the specified agent.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]velThe movement velocity. [(x, y, z)]
返回
True if the request was successfully submitted.

◆ resetAgentVelocity()

bool dtCrowd::resetAgentVelocity ( const int  idx)

[UE4] Resets agent's velocity

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]

◆ resetMoveTarget()

bool dtCrowd::resetMoveTarget ( const int  idx)

Resets any request for the specified agent.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
返回
True if the request was successfully reseted.

◆ setAgentBackOnLink()

bool dtCrowd::setAgentBackOnLink ( const int  idx)

[UE4] Switch to offmesh link state

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]

◆ setAgentCheckInterval()

void dtCrowd::setAgentCheckInterval ( const float  t)

[UE4] Set time between attempts to restore agents state

参数
[in]tTime in seconds

◆ setAgentCorridor()

bool dtCrowd::setAgentCorridor ( const int  idx,
const dtPolyRef *  path,
const int  npath 
)

[UE4] Set agent corridor, works only just after requesting move target when agent didn't start any pathfinding operations yet Use with caution!

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]pathThe path corridor. [(polyRef) * npolys]
[in]npathThe number of polygons in the path.

◆ setAgentWaiting()

bool dtCrowd::setAgentWaiting ( const int  idx)

[UE4] Switch to waiting state

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]

◆ setObstacleAvoidanceParams()

void dtCrowd::setObstacleAvoidanceParams ( const int  idx,
const dtObstacleAvoidanceParams *  params 
)

Sets the shared avoidance configuration for the specified index.

参数
[in]idxThe index. [Limits: 0 <= value < DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS]
[in]paramsThe new configuration.

◆ setObstacleAvoidancePattern()

void dtCrowd::setObstacleAvoidancePattern ( int  idx,
const float *  angles,
const float *  radii,
int  nsamples 
)

[UE4] Sets the shared avoidance sampling pattern for the specified index.

参数
[in]idxThe index.
[in]anglesradians from direction of desired velocity [Count: nsamples]
[in]radiinormalized radii (0..1) for each sample [Count: nsamples]
[in]nsamplesThe number of samples

◆ setSingleAreaVisibilityOptimization()

void dtCrowd::setSingleAreaVisibilityOptimization ( bool  bEnable)

[UE4] Set visibility optimization to use single area raycasts This will prevent from cutting through polys marked as different area which could have been avoided in corridor's path

参数
[in]bEnableNew state of single area raycast mode

◆ update()

void dtCrowd::update ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

Updates the steering and positions of all agents.

参数
[in]dtThe time, in seconds, to update the simulation. [Limit: > 0]
[out]debugA debug object to load with debug information. [Opt]

◆ updateAgentFilter()

bool dtCrowd::updateAgentFilter ( const int  idx,
const dtQueryFilter *  filter 
)

[UE4] Updates the specified agent's query filter.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]filterThe new filter.
返回
True if the request was successfully submitted.

◆ updateAgentParameters()

void dtCrowd::updateAgentParameters ( const int  idx,
const dtCrowdAgentParams &  params 
)

Updates the specified agent's configuration.

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]paramsThe new agent configuration.

◆ updateAgentState()

void dtCrowd::updateAgentState ( const int  idx,
bool  repath 
)

[UE4] Refresh state of agent, used after completing movement through offmesh links

参数
[in]idxThe agent index. [Limits: 0 <= value < getAgentCount()]
[in]repathIf set, agent will invalidate its path

◆ updateStepAvoidance()

void dtCrowd::updateStepAvoidance ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: avoidance

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepCorridor()

void dtCrowd::updateStepCorridor ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: corridor updates at new position

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepMove()

void dtCrowd::updateStepMove ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: integrate velocities and handle collisions

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepNextMovePoint()

void dtCrowd::updateStepNextMovePoint ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: next corner for move, trigger offmesh links

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepOffMeshAnim()

void dtCrowd::updateStepOffMeshAnim ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: offmesh anims

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepOffMeshVelocity()

void dtCrowd::updateStepOffMeshVelocity ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: offmesh link velocity (instead of playing animation)

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepPaths()

void dtCrowd::updateStepPaths ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: path validity, path cache and path optimizations

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepProximityData()

void dtCrowd::updateStepProximityData ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: neighbors and boundaries

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

◆ updateStepSteering()

void dtCrowd::updateStepSteering ( const float  dt,
dtCrowdAgentDebugInfo *  debug 
)

[UE4] Split update into several smaller components: steering

参数
[in]dtDelta time in seconds
[in]nagentsNumber of active agents

该类的文档由以下文件生成: