载入中...
搜索中...
未找到
eve::crowd::Crowd类 参考

群体行为模块:连续流场寻路 + 海量单位移动/转向/行动 + Boids 鸟群。 更多...

#include <Crowd.h>

类 eve::crowd::Crowd 继承关系图:
eve::Module

类

struct  Impl
 Private crowd runtime storage. @cost Linear in agent count for SOA vectors and transient broadphase/avoidance work buffers; capacity is bounded by maxAgents. 更多...
 

Public 成员函数

 Module_REG (Crowd)
 
 Crowd ()
 Crowd.
 
 ~Crowd () override
 Crowd.
 
void resizeField (int width, int height, float cellSize, float originX, float originY)
 配置流场网格(世界单位/格)。
 
void setBlocked (int cx, int cy, bool blocked)
 设置/清除某格阻挡。
 
void setCellCost (int cx, int cy, float cost)
 设置地形代价(0=阻挡,>=1 可走)。
 
float getCellCost (int cx, int cy) const
 查询地形代价。
 
void buildFlowField (int gx, int gy)
 单目标快捷建场(clearGoals + addGoal + build)。
 
void addFlowGoal (int gx, int gy)
 追加目标格(多目标)。
 
void clearFlowGoals ()
 清空目标列表。
 
void build ()
 执行 Dijkstra 建场。
 
bool isFieldBuilt () const
 是否已建场。
 
bool isReachable (int cx, int cy) const
 某格是否可达。
 
int getFieldWidth () const
 网格信息访问器(调试渲染用)。
 
int getFieldHeight () const
 Returns the field height.
 
float getCellSize () const
 Returns the cell size.
 
float getFieldOriginX () const
 Returns the field origin x.
 
float getFieldOriginY () const
 Returns the field origin y.
 
FlowVec flowAtWorld (float wx, float wy) const
 世界坐标流场方向(双线性插值;场外返回零向量)。
 
float costAtWorld (float wx, float wy) const
 世界坐标积分代价(场外返回 kUnreachable)。
 
FlowVec flowAtCell (int cx, int cy) const
 格级流场方向。
 
int addAgent (float x, float y, float heading, float radius)
 添加单位;返回 id(=槽位索引;删除后 id 不稳定)。
 
int addNamedAgent (const std::string &stableId, float x, float y, float heading, float radius)
 Add an agent with an editor/game-stable logical identifier.
 
bool hasNamedAgent (const std::string &stableId) const
 Return whether a stable logical agent exists.
 
int getNamedAgentIndex (const std::string &stableId) const
 Resolve a stable logical identifier to the current compact slot.
 
std::string getAgentStableId (int index) const
 Return the stable logical identifier for a compact slot.
 
bool removeNamedAgent (const std::string &stableId)
 Remove an agent by stable logical identifier.
 
bool removeAgent (int id)
 删除单位(swap-pop O(1))。
 
void clearAgents ()
 清空全部单位。
 
int getAgentCount () const
 当前单位数。
 
void setMaxAgents (int maxAgents)
 单位容量上限(默认 100000)。
 
int getMaxAgents () const
 Returns the max agents.
 
bool setAgentAction (int id, const std::string &action)
 设置行动:"idle" | "flow" | "seek" | "boids"。
 
std::string getAgentAction (int id) const
 查询行动名。
 
bool setAgentTarget (int id, float tx, float ty)
 设置世界目标点(seek 直接寻点,boids 作迁移偏置)。
 
bool clearAgentTarget (int id)
 清除目标点。
 
bool setAgentSpeed (int id, float speed)
 设置最大速度(世界单位/秒)。
 
bool setAgentAccel (int id, float accel)
 设置加速度上限(默认 maxSpeed×2)。
 
bool setAgentTurnRate (int id, float radPerSec)
 设置转向速率上限(弧度/秒)。
 
bool setAgentRadius (int id, float radius)
 设置半径。
 
bool setAgentData (int id, int data)
 设置游戏自定义标记。
 
int getAgentData (int id) const
 Returns the agent data.
 
Result< void > setAgentAvoidancePriority (int id, int priority)
 Set overlap-resolution priority; higher values yield less.
 
int getAgentAvoidancePriority (int id) const
 Return overlap-resolution priority, or zero for an invalid id.
 
Result< void > setAgentInteraction (int id, AgentInteraction policy)
 Atomically replace the local interaction policy for a current compact slot.
 
Result< AgentInteraction > getAgentInteraction (int id) const
 Read an owning policy snapshot, or NotFound for an invalid compact slot. @thread Simulation thread only. @lifetime The copy survives subsequent mutations.
 
Result< SpawnReceipt > applySpawnBatch (const SpawnBatch &batch)
 Apply a caller-built spawn batch atomically, including neighbor displacement.
 
bool setAgentPosition (int id, float x, float y)
 直接放置单位。
 
AgentState getAgentState (int id) const
 读取单位状态快照(非法 id 返回 action=-1)。
 
void setDefaultSpeed (float speed)
 新单位默认速度。
 
void setDefaultRadius (float radius)
 新单位默认半径。
 
void setDefaultTurnRate (float radPerSec)
 新单位默认转向速率(弧度/秒)。
 
void setArriveRadius (float radius)
 seek 到达减速半径。
 
void setSeparationRadius (float radius)
 分离/邻居查询半径。
 
void setPerceptionRadius (float radius)
 对齐/聚合感知半径(Boids;默认 64,可大于分离半径)。
 
void setSeparationWeight (float weight)
 Boids 分离力权重。
 
void setAlignmentWeight (float weight)
 Boids 对齐力权重。
 
void setCohesionWeight (float weight)
 Boids 聚合力权重。
 
void setWanderWeight (float weight)
 Boids wander 权重。
 
void setGoalWeight (float weight)
 Boids 目标偏置权重。
 
void setResolveOverlaps (bool enable)
 是否做位置重叠消解 pass(默认开)。
 
void setClampToField (bool enable)
 是否把单位钳制在流场边界内(默认开)。
 
Result< void > configureAvoidance (AvoidanceSettings settings)
 Configure predictive velocity sampling; invalid input leaves settings unchanged.
 
AvoidanceSettings getAvoidanceSettings () const
 Return an owning settings snapshot. @thread Simulation thread only.
 
Result< StepReport > advance (float dt)
 Advance using bounded simultaneous integration and contact projection.
 
void step (float dt)
 Compatibility-only stepping facade; delegates to advance and throws on rejected input. Use advance to inspect residual crowding and handle failure. @thread Simulation thread only. @reentrancy No callbacks or reentry.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

详细描述

群体行为模块:连续流场寻路 + 海量单位移动/转向/行动 + Boids 鸟群。

Script: crowd <- eve.Crowd();

纯 CPU 仿真,与渲染解耦:每帧调用 step(dt) 推进;渲染/游戏逻辑通过 getPositions / getHeadings 批量读取(脚本预分配数组),万级单位无需逐单位回调。

行动模式: idle —— 不主动移动(分离力仍生效); flow —— 沿流场方向行军(Boids 分离力防扎堆); seek —— 向世界目标点移动,进入 arriveRadius 后线性减速; boids —— 鸟群:分离 + 对齐 + 聚合,可叠加目标偏置与 wander。

在文件 Crowd.h 第 116 行定义.

构造及析构函数说明

◆ Crowd()

eve::crowd::Crowd::Crowd ( )

Crowd.

在文件 Crowd.cpp 第 43 行定义.

◆ ~Crowd()

eve::crowd::Crowd::~Crowd ( )
overridedefault

成员函数说明

◆ addAgent()

int eve::crowd::Crowd::addAgent ( float  x,
float  y,
float  heading,
float  radius 
)

添加单位;返回 id(=槽位索引;删除后 id 不稳定)。

参数
x世界 X
y世界 Y
heading初始朝向(弧度)
radius半径(用于分离/重叠消解)
返回
单位 id,达到上限返回 -1

在文件 Crowd.cpp 第 99 行定义.

引用了 d, heading, id, radius, x , 以及 y.

被这些函数引用 addNamedAgent().

◆ addFlowGoal()

void eve::crowd::Crowd::addFlowGoal ( int  gx,
int  gy 
)

追加目标格(多目标)。

在文件 Crowd.cpp 第 67 行定义.

◆ addNamedAgent()

int eve::crowd::Crowd::addNamedAgent ( const std::string &  stableId,
float  x,
float  y,
float  heading,
float  radius 
)

Add an agent with an editor/game-stable logical identifier.

参数
stableIdNon-empty logical identifier unique within this Crowd.
xInitial world X coordinate.
yInitial world Y coordinate.
headingInitial heading in radians.
radiusAgent collision radius.
返回
Current compact slot, or -1 when the identifier or capacity is invalid.

在文件 Crowd.cpp 第 125 行定义.

引用了 addAgent(), d, heading, index, radius, x , 以及 y.

被这些函数引用 applySpawnBatch() , 以及 eve::rts::CrowdMotionSystem::step().

◆ advance()

Result< StepReport > eve::crowd::Crowd::advance ( float  dt)

Advance using bounded simultaneous integration and contact projection.

参数
dtFinite, non-negative caller-supplied simulation seconds; zero is a no-op.
返回
Owning residual-contact report, or InvalidArgument/PreconditionViolation before mutation for invalid time or more than 1024 required substeps. @ownership Crowd retains agents; the report owns its observations. @lifetime Report values remain valid independently of subsequent mutations. @thread Simulation thread only; no concurrent access to this Crowd. @reentrancy No callbacks and no reentrant mutation. @cost Per tick, linear storage work plus local neighbor work per substep/contact iteration; dense clusters can be quadratic. Reuse one report per game tick.

Substeps are at most 1/60 second and limit travel relative to positive agent radii and terrain cell size. Call with a fixed dt sequence for repeatability on one build; cross-platform bit-exact replay is not guaranteed. Residual contacts are reported rather than pretending an impossible packing was solved.

在文件 CrowdStep.cpp 第 6 行定义.

引用了 eve::Applied, eve::crowd::StepReport::avoidanceChecks, eve::crowd::StepReport::avoidanceTruncations, count, d, eve::Diagnostic::error(), EV_PROFILE_MODULE, eve::Result< T >::failure(), eve::InvalidArgument, eve::NoOp, eve::PreconditionViolation, eve::crowd::StepReport::substeps, eve::Status::success(), eve::Result< T >::success(), eve::crowd::StepReport::unresolvedWalls, x , 以及 y.

被这些函数引用 eve::rts::CrowdMotionSystem::step() , 以及 step().

◆ applySpawnBatch()

Result< SpawnReceipt > eve::crowd::Crowd::applySpawnBatch ( const SpawnBatch &  batch)

Apply a caller-built spawn batch atomically, including neighbor displacement.

参数
batchUp to 1024 uniquely named agents and explicit placement/work budgets.
返回
Owning receipt, or a diagnostic without any world mutation on failure. @ownership Copies the batch; retains no caller references. Existing targets and velocities are preserved. @thread Simulation thread only. @reentrancy No callbacks or reentry. @cost Copies current simulation/field storage once per batch, then performs bounded candidate/contact work. Amortize by batching spawns; NearestFree chooses the first clear deterministic ring sample, not a continuous optimum.

PushNeighbors anchors all new agents, respects existing hold/pushability and interaction masks, and only moves the connected contact region. No simulation time is advanced. Terrain and distance limits are enforced before commit. Budget exhaustion is a visible failure, never a partial creation.

在文件 CrowdSpawn.cpp 第 35 行定义.

引用了 active, addNamedAgent(), eve::crowd::SpawnBatch::agents, angle, eve::Applied, eve::crowd::SpawnReceipt::checks, code, eve::Conflict, count, eve::crowd::SpawnReceipt::created, d, depth, eve::crowd::SpawnReceipt::displacedAgents, distance, dx, dy, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::InvariantViolation, left, length, limit, eve::crowd::SpawnBatch::maxChecks, eve::crowd::SpawnBatch::maxDistance, eve::crowd::SpawnBatch::maxPasses, message, eve::crowd::NearestFree, eve::NoOp, eve::crowd::SpawnBatch::policy, eve::PreconditionViolation, eve::crowd::PushNeighbors, radius, eve::crowd::RejectOverlap, request, right, scale, eve::crowd::SpawnBatch::searchSpacing, setAgentInteraction(), eve::Status::success(), eve::Result< T >::success(), x , 以及 y.

◆ build()

void eve::crowd::Crowd::build ( )

执行 Dijkstra 建场。

在文件 Crowd.cpp 第 71 行定义.

◆ buildFlowField()

void eve::crowd::Crowd::buildFlowField ( int  gx,
int  gy 
)

单目标快捷建场(clearGoals + addGoal + build)。

在文件 Crowd.cpp 第 62 行定义.

◆ clearAgents()

void eve::crowd::Crowd::clearAgents ( )

清空全部单位。

在文件 Crowd.cpp 第 203 行定义.

引用了 d.

◆ clearAgentTarget()

bool eve::crowd::Crowd::clearAgentTarget ( int  id)

清除目标点。

在文件 Crowd.cpp 第 257 行定义.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ clearFlowGoals()

void eve::crowd::Crowd::clearFlowGoals ( )

清空目标列表。

在文件 Crowd.cpp 第 69 行定义.

◆ configureAvoidance()

Result< void > eve::crowd::Crowd::configureAvoidance ( AvoidanceSettings  settings)

Configure predictive velocity sampling; invalid input leaves settings unchanged.

返回
Applied or InvalidArgument. @ownership Copies the settings. @thread Simulation thread only. @reentrancy No callbacks or reentry.

Sampling respects acceleration limits and prefers passing on the right.

  • It is a local heuristic, not a collision-free or deadlock-free guarantee; inspect advance reports.

在文件 CrowdAvoidance.cpp 第 7 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, settings, eve::Status::success() , 以及 eve::Result< T >::success().

◆ costAtWorld()

float eve::crowd::Crowd::costAtWorld ( float  wx,
float  wy 
) const

世界坐标积分代价(场外返回 kUnreachable)。

在文件 Crowd.cpp 第 89 行定义.

引用了 wx , 以及 wy.

◆ flowAtCell()

FlowVec eve::crowd::Crowd::flowAtCell ( int  cx,
int  cy 
) const

格级流场方向。

在文件 Crowd.cpp 第 91 行定义.

引用了 cx, cy , 以及 v.

◆ flowAtWorld()

FlowVec eve::crowd::Crowd::flowAtWorld ( float  wx,
float  wy 
) const

世界坐标流场方向(双线性插值;场外返回零向量)。

在文件 Crowd.cpp 第 83 行定义.

引用了 v, wx , 以及 wy.

◆ getAgentAction()

std::string eve::crowd::Crowd::getAgentAction ( int  id) const

查询行动名。

在文件 Crowd.cpp 第 244 行定义.

◆ getAgentAvoidancePriority()

int eve::crowd::Crowd::getAgentAvoidancePriority ( int  id) const

Return overlap-resolution priority, or zero for an invalid id.

在文件 Crowd.cpp 第 306 行定义.

◆ getAgentCount()

int eve::crowd::Crowd::getAgentCount ( ) const

当前单位数。

在文件 Crowd.cpp 第 228 行定义.

◆ getAgentData()

int eve::crowd::Crowd::getAgentData ( int  id) const

Returns the agent data.

在文件 Crowd.cpp 第 293 行定义.

◆ getAgentInteraction()

Result< AgentInteraction > eve::crowd::Crowd::getAgentInteraction ( int  id) const

Read an owning policy snapshot, or NotFound for an invalid compact slot. @thread Simulation thread only. @lifetime The copy survives subsequent mutations.

在文件 CrowdInteraction.cpp 第 20 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound , 以及 eve::Result< T >::success().

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ getAgentStableId()

std::string eve::crowd::Crowd::getAgentStableId ( int  index) const

Return the stable logical identifier for a compact slot.

参数
indexCurrent compact slot.
返回
Stable identifier, or an empty string for invalid or anonymous slots.

在文件 Crowd.cpp 第 144 行定义.

引用了 index.

◆ getAgentState()

AgentState eve::crowd::Crowd::getAgentState ( int  id) const

读取单位状态快照(非法 id 返回 action=-1)。

在文件 Crowd.cpp 第 317 行定义.

引用了 eve::crowd::AgentState::action , 以及 s.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ getAvoidanceSettings()

AvoidanceSettings eve::crowd::Crowd::getAvoidanceSettings ( ) const

Return an owning settings snapshot. @thread Simulation thread only.

在文件 CrowdAvoidance.cpp 第 17 行定义.

◆ getCellCost()

float eve::crowd::Crowd::getCellCost ( int  cx,
int  cy 
) const

查询地形代价。

在文件 Crowd.cpp 第 60 行定义.

引用了 cx , 以及 cy.

◆ getCellSize()

float eve::crowd::Crowd::getCellSize ( ) const

Returns the cell size.

在文件 Crowd.cpp 第 79 行定义.

◆ getFieldHeight()

int eve::crowd::Crowd::getFieldHeight ( ) const

Returns the field height.

在文件 Crowd.cpp 第 78 行定义.

◆ getFieldOriginX()

float eve::crowd::Crowd::getFieldOriginX ( ) const

Returns the field origin x.

在文件 Crowd.cpp 第 80 行定义.

◆ getFieldOriginY()

float eve::crowd::Crowd::getFieldOriginY ( ) const

Returns the field origin y.

在文件 Crowd.cpp 第 81 行定义.

◆ getFieldWidth()

int eve::crowd::Crowd::getFieldWidth ( ) const

网格信息访问器(调试渲染用)。

在文件 Crowd.cpp 第 77 行定义.

◆ getMaxAgents()

int eve::crowd::Crowd::getMaxAgents ( ) const

Returns the max agents.

在文件 Crowd.cpp 第 234 行定义.

◆ getNamedAgentIndex()

int eve::crowd::Crowd::getNamedAgentIndex ( const std::string &  stableId) const

Resolve a stable logical identifier to the current compact slot.

参数
stableIdLogical identifier to resolve.
返回
Current compact slot, or -1 when missing.

在文件 Crowd.cpp 第 139 行定义.

引用了 found.

被这些函数引用 removeNamedAgent() , 以及 eve::rts::CrowdMotionSystem::step().

◆ hasNamedAgent()

bool eve::crowd::Crowd::hasNamedAgent ( const std::string &  stableId) const

Return whether a stable logical agent exists.

参数
stableIdLogical identifier to query.
返回
True when the identifier is currently mapped.

在文件 Crowd.cpp 第 135 行定义.

◆ isFieldBuilt()

bool eve::crowd::Crowd::isFieldBuilt ( ) const

是否已建场。

在文件 Crowd.cpp 第 73 行定义.

◆ isReachable()

bool eve::crowd::Crowd::isReachable ( int  cx,
int  cy 
) const

某格是否可达。

在文件 Crowd.cpp 第 75 行定义.

引用了 cx , 以及 cy.

◆ Module_REG()

eve::crowd::Crowd::Module_REG ( Crowd  )

◆ removeAgent()

bool eve::crowd::Crowd::removeAgent ( int  id)

删除单位(swap-pop O(1))。

在文件 Crowd.cpp 第 153 行定义.

引用了 d , 以及 id.

被这些函数引用 removeNamedAgent().

◆ removeNamedAgent()

bool eve::crowd::Crowd::removeNamedAgent ( const std::string &  stableId)

Remove an agent by stable logical identifier.

参数
stableIdLogical identifier to remove.
返回
True when an existing agent was removed.

在文件 Crowd.cpp 第 148 行定义.

引用了 getNamedAgentIndex(), index , 以及 removeAgent().

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ resizeField()

void eve::crowd::Crowd::resizeField ( int  width,
int  height,
float  cellSize,
float  originX,
float  originY 
)

配置流场网格(世界单位/格)。

在文件 Crowd.cpp 第 48 行定义.

引用了 height , 以及 width.

◆ setAgentAccel()

bool eve::crowd::Crowd::setAgentAccel ( int  id,
float  accel 
)

设置加速度上限(默认 maxSpeed×2)。

在文件 Crowd.cpp 第 269 行定义.

◆ setAgentAction()

bool eve::crowd::Crowd::setAgentAction ( int  id,
const std::string &  action 
)

设置行动:"idle" | "flow" | "seek" | "boids"。

在文件 Crowd.cpp 第 236 行定义.

引用了 a , 以及 action.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentAvoidancePriority()

Result< void > eve::crowd::Crowd::setAgentAvoidancePriority ( int  id,
int  priority 
)

Set overlap-resolution priority; higher values yield less.

返回
Applied, or NotFound for an invalid slot.

在文件 Crowd.cpp 第 298 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, priority, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentData()

bool eve::crowd::Crowd::setAgentData ( int  id,
int  data 
)

设置游戏自定义标记。

在文件 Crowd.cpp 第 287 行定义.

◆ setAgentInteraction()

Result< void > eve::crowd::Crowd::setAgentInteraction ( int  id,
AgentInteraction  policy 
)

Atomically replace the local interaction policy for a current compact slot.

参数
idCurrent slot; resolve stable identity again after any removal.
policyCopied policy with finite pushability in [0,1] and non-negative masks.
返回
Applied, InvalidArgument or NotFound; failure leaves the policy unchanged. @ownership Crowd owns a copy. @thread Simulation thread only. @reentrancy No callbacks or reentrant mutation.

在文件 CrowdInteraction.cpp 第 5 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::crowd::AgentInteraction::holdPosition, index, eve::InvalidArgument, eve::crowd::AgentInteraction::layer, eve::crowd::AgentInteraction::mask, eve::NotFound, eve::crowd::AgentInteraction::pushability, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 applySpawnBatch() , 以及 eve::rts::CrowdMotionSystem::step().

◆ setAgentPosition()

bool eve::crowd::Crowd::setAgentPosition ( int  id,
float  x,
float  y 
)

直接放置单位。

在文件 Crowd.cpp 第 310 行定义.

引用了 x , 以及 y.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentRadius()

bool eve::crowd::Crowd::setAgentRadius ( int  id,
float  radius 
)

设置半径。

在文件 Crowd.cpp 第 281 行定义.

引用了 radius.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentSpeed()

bool eve::crowd::Crowd::setAgentSpeed ( int  id,
float  speed 
)

设置最大速度(世界单位/秒)。

在文件 Crowd.cpp 第 263 行定义.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentTarget()

bool eve::crowd::Crowd::setAgentTarget ( int  id,
float  tx,
float  ty 
)

设置世界目标点(seek 直接寻点,boids 作迁移偏置)。

在文件 Crowd.cpp 第 249 行定义.

被这些函数引用 eve::rts::CrowdMotionSystem::step().

◆ setAgentTurnRate()

bool eve::crowd::Crowd::setAgentTurnRate ( int  id,
float  radPerSec 
)

设置转向速率上限(弧度/秒)。

在文件 Crowd.cpp 第 275 行定义.

◆ setAlignmentWeight()

void eve::crowd::Crowd::setAlignmentWeight ( float  weight)

Boids 对齐力权重。

在文件 Crowd.cpp 第 346 行定义.

引用了 weight.

◆ setArriveRadius()

void eve::crowd::Crowd::setArriveRadius ( float  radius)

seek 到达减速半径。

在文件 Crowd.cpp 第 342 行定义.

引用了 radius.

◆ setBlocked()

void eve::crowd::Crowd::setBlocked ( int  cx,
int  cy,
bool  blocked 
)

设置/清除某格阻挡。

在文件 Crowd.cpp 第 52 行定义.

引用了 cx , 以及 cy.

◆ setCellCost()

void eve::crowd::Crowd::setCellCost ( int  cx,
int  cy,
float  cost 
)

设置地形代价(0=阻挡,>=1 可走)。

在文件 Crowd.cpp 第 56 行定义.

引用了 cost, cx , 以及 cy.

◆ setClampToField()

void eve::crowd::Crowd::setClampToField ( bool  enable)

是否把单位钳制在流场边界内(默认开)。

在文件 Crowd.cpp 第 351 行定义.

◆ setCohesionWeight()

void eve::crowd::Crowd::setCohesionWeight ( float  weight)

Boids 聚合力权重。

在文件 Crowd.cpp 第 347 行定义.

引用了 weight.

◆ setDefaultRadius()

void eve::crowd::Crowd::setDefaultRadius ( float  radius)

新单位默认半径。

在文件 Crowd.cpp 第 338 行定义.

引用了 radius.

◆ setDefaultSpeed()

void eve::crowd::Crowd::setDefaultSpeed ( float  speed)

新单位默认速度。

在文件 Crowd.cpp 第 337 行定义.

◆ setDefaultTurnRate()

void eve::crowd::Crowd::setDefaultTurnRate ( float  radPerSec)

新单位默认转向速率(弧度/秒)。

在文件 Crowd.cpp 第 339 行定义.

◆ setGoalWeight()

void eve::crowd::Crowd::setGoalWeight ( float  weight)

Boids 目标偏置权重。

在文件 Crowd.cpp 第 349 行定义.

引用了 weight.

◆ setMaxAgents()

void eve::crowd::Crowd::setMaxAgents ( int  maxAgents)

单位容量上限(默认 100000)。

在文件 Crowd.cpp 第 230 行定义.

◆ setPerceptionRadius()

void eve::crowd::Crowd::setPerceptionRadius ( float  radius)

对齐/聚合感知半径(Boids;默认 64,可大于分离半径)。

在文件 Crowd.cpp 第 344 行定义.

引用了 radius.

◆ setResolveOverlaps()

void eve::crowd::Crowd::setResolveOverlaps ( bool  enable)

是否做位置重叠消解 pass(默认开)。

在文件 Crowd.cpp 第 350 行定义.

◆ setSeparationRadius()

void eve::crowd::Crowd::setSeparationRadius ( float  radius)

分离/邻居查询半径。

在文件 Crowd.cpp 第 343 行定义.

引用了 radius.

◆ setSeparationWeight()

void eve::crowd::Crowd::setSeparationWeight ( float  weight)

Boids 分离力权重。

在文件 Crowd.cpp 第 345 行定义.

引用了 weight.

◆ setWanderWeight()

void eve::crowd::Crowd::setWanderWeight ( float  weight)

Boids wander 权重。

在文件 Crowd.cpp 第 348 行定义.

引用了 weight.

◆ step()

void eve::crowd::Crowd::step ( float  dt)

Compatibility-only stepping facade; delegates to advance and throws on rejected input. Use advance to inspect residual crowding and handle failure. @thread Simulation thread only. @reentrancy No callbacks or reentry.

在文件 CrowdStep.cpp 第 78 行定义.

引用了 advance().


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