Avoidance.h
Source/MassBattle/Public/Fragments/Avoidance.h
概述 Overview
避障系统的 fragment 集合:配置 FAvoidance(算法选择 RVO2 / ForceField / Hybrid、避障组与忽略组衰减、检测范围、制动范围上限、交通规则总闸)、运行时状态 FAvoiding(期望/当前/避让速度与避障半径,快照恢复),以及避障求解的邻居数据载体 FCapsuleRVOData / FSegmentObstPointRVOData / FSegmentObstRVOData / FBoxObstRVOData(从网格数据构造,供 RVO 求解器消费)。
Avoidance fragment collection: config FAvoidance (algorithm choice RVO2 / ForceField / Hybrid, avoidance groups with ignore-group attenuation, detect ranges, braking-range cap, global traffic-rules gate), runtime state FAvoiding (desired / current / avoiding velocity and avoid radius; snapshot-restored), and the neighbor data carriers FCapsuleRVOData / FSegmentObstPointRVOData / FSegmentObstRVOData / FBoxObstRVOData (constructed from grid data, consumed by the RVO solver).
FAvoidance USTRUCT
避障配置 fragment(FA_MassBattleBaseFragment 派生)。所有字段为策划在 EntityConfig 中可调参数,运行时不变。
Avoidance config fragment (derived from FA_MassBattleBaseFragment). All fields are designer-tunable EntityConfig parameters, constant at runtime.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
bEnable | bool | true | 是否启用避障功能。Whether to enable avoidance functionality. |
Group | int32 | 1 | 自身避障组(1-8)。Self avoidance group (1-8). |
IgnoreGroupFlags | uint8 | 0 | 不避让这些组(位掩码:标志1 = 组1 … 标志8 = 组8)。单向:被无视的一方仍能看到你,并将你视为不可推动障碍(承担全责)。部分衰减见 IgnoreGroupAlpha——位置 1 且 alpha=0 即旧版完全排除。Groups to not avoid (bitmask: Flag1 = Group 1 ... Flag8 = Group 8). One-directional: the ignored side still sees you and treats you as an immovable obstacle (full responsibility). See IgnoreGroupAlpha for PARTIAL attenuation — a set bit with alpha 0 is the legacy full exclusion. |
IgnoreGroupAlpha | float | 0.f | 作用于 IgnoreGroupFlags 掩码全部置位组的避让衰减:0 = 完全排除(默认,旧行为——邻居不进入 RVO 列表);1 = 正常避障(等同掩码未置);中间 = 部分——邻居以衰减权重入列,求解器按权重缩放逐对约束强度(ORCA 收缩合成半径,ForceField 缩放斥力)。交通规则偏置与反向全责覆写保持二值。Avoidance attenuation applied to ALL groups masked by IgnoreGroupFlags: 0 = full exclusion (default, legacy — the neighbor never enters the RVO list); 1 = full avoidance (equivalent to the mask being clear); in between = partial — the neighbor is admitted at attenuated weight and the solvers scale their per-pair constraint strength (ORCA shrinks the combined radius, ForceField scales the repulsion). Traffic-rule biases and the reverse-side full-responsibility override remain binary. |
AvoidanceMode | EAvoidanceMode | RVO2 | 避障算法:RVO2(合作速度障碍)或 ForceField(质量加权斥力);枚举另有 Hybrid 混合模式。RVO2 适合载具(速度空间硬约束);ForceField 适合轻步兵(平滑斥力,自然穿行人群)。Avoidance algorithm: RVO2 (cooperative velocity obstacles) or ForceField (mass-weighted repulsion); the enum also has a Hybrid mode. RVO2 suits vehicles (hard velocity-space constraint); ForceField suits light infantry (smooth repulsion, naturally threads crowds). |
ForceField_Strength | float | 1500.f | 单个完全重叠邻居/墙体贡献的最大分离速度(cm/s),编辑器显示名 "Separation Speed"。直接作为速度施加(不乘 dt)——斥力是纯位置函数,帧率无关且任意逻辑帧率下无条件稳定(无弹簧积分、无振荡)。建议起始值约 1.5-3.0 倍 MoveSpeed(如 MoveSpeed 1000 时取 1500-3000);调得远高于此只会让斜坡近似阶跃(外缘处方向翻转)而推力不再增长——总推力由 ForceField_SepSpeedCapFraction 决定,不是这个值。仅 ForceField / Hybrid 模式可见。Max separation velocity contribution from one fully-overlapping neighbor/wall (cm/s); editor display name "Separation Speed". Applied DIRECTLY as a velocity (no dt scaling) — the repulsion is a pure position function, so it is frame-rate independent and unconditionally stable at any logic tick rate (no spring integration, no oscillation). Recommended start ~1.5-3.0× MoveSpeed (e.g. 1500-3000 for MoveSpeed 1000); raising it far beyond that only makes the ramp step-like (direction flips at the rim) with no extra push — the TOTAL push is governed by ForceField_SepSpeedCapFraction, not by this value. ForceField / Hybrid modes only. |
ForceField_SepSpeedCapFraction | float | 1.f | 总分离速度上限,占 MaxSpeed 的比例,编辑器显示名 "Sep Speed Cap Fraction"。分离预算与移动预算独立(期望速度自行钳到 MaxSpeed,二者相加不再二次钳制);推挤期间合速度可超 MaxSpeed 至约 (1+fraction) 倍,由下游加减速限制平滑。1.0 = 总分离速度不超过 MoveSpeed;1.5-2.0 = 密集近战的明显推挤分离。仅 ForceField / Hybrid 模式可见。Cap on the TOTAL accumulated separation velocity as a fraction of MaxSpeed; editor display name "Sep Speed Cap Fraction". The separation budget is INDEPENDENT of the locomotion budget (the desired velocity is clamped to MaxSpeed on its own; the two are summed without re-clamping); during a shove the combined velocity may exceed MaxSpeed up to ~(1+fraction)×, smoothed by downstream accel/decel limits. 1.0 = total separation never exceeds MoveSpeed; 1.5-2.0 = visible crowd push-out for packed melee. ForceField / Hybrid modes only. |
ForceField_VelocityDamping | float | 1.f | 分离速度阻尼(ForceField/Hybrid),编辑器显示名 "Velocity Damping"。每邻居推力 = 钳制(目标分离速度 − 此值×相对分离速度, 0, 目标),相对分离速度 =(自身−邻居)速度沿推开方向的投影。已在分开的邻居对不再追加推力——消灭低帧率下的 bang-bang 震荡;远离中的邻居完全不再推人,接近中的邻居保持全额推力(真实人群的标定形状,Johansson 2008)。0 = 旧无阻尼场。仅 ForceField / Hybrid 模式可见。Separation velocity damping (ForceField/Hybrid); editor display name "Velocity Damping". Per-neighbor push = clamp(Target − this × RELATIVE separation speed, 0, Target), relative speed = (self − neighbor) velocity along the push direction. Already-separating pairs contribute zero additional push — kills the low-tick bang-bang oscillation; a receding neighbor stops pushing entirely while an approaching one keeps full push (the shape real crowds exhibit, Johansson 2008 calibration). 0 = legacy undamped field. ForceField / Hybrid modes only. |
AvoidDistMult | FVector2f | (1, 1) | 椭圆避障倍数:X=主轴(沿胶囊体轴投影方向),Y=副轴(垂直方向)。基础半径 = 胶囊体边界圆半径。Elliptical avoidance multiplier: X = major axis (along capsule shaft projection), Y = minor (perpendicular). Base radius = capsule bounding circle radius. |
MaxNeighbors_Agent | int32 | 10 | 列入考量的单位最大数量,近距优先。Maximum number of agents to consider, prioritizing closer ones. |
MaxNeighbors_Obstacle | int32 | 10 | 列入考量的障碍物最大数量,近距优先。Maximum number of obstacles to consider, prioritizing closer ones. |
RVO_TimeHorizon_Agent | float | 1.0f | 通过动态调整视野半径,提前躲避这个时间后会碰撞的单位。Dynamically adjusts the detect range to avoid agents that would collide after this time. |
RVO_TimeHorizon_Obstacle | float | 0.1f | 通过动态调整视野半径,提前躲避这个时间后会碰撞的障碍物。Dynamically adjusts the detect range to avoid obstacles that would collide after this time. |
DetectRange_Agent | FVector2f | (0, 150) | 单位检测距离(X: Min, Y: Max)——实际碰撞尺寸之外的扩展量(碰撞形状 Z 轴投影外切圆计为 0;ColliderMult 仅作用于 PBD,此处不适用)。最终 = 身体半径 + Clamp(时间范围×速度, Min, Max)。Min 同时钳制求解器的避障检测半径与交通规则的邻居视野——如 0 = 从身体边缘开始检测,100 = 身体外 100。Agent detection distance (X: Min, Y: Max) — an EXTENSION beyond the actual collision size (the circumscribed circle of the collision shape's Z-axis projection counts as 0; ColliderMult is PBD-only and does NOT apply). Final = BodyRadius + Clamp(TimeHorizon×Speed, Min, Max). The Min floors BOTH the solver's avo detection and the traffic rules' neighbor view — e.g. 0 = detection starts at the body edge, 100 = body + 100. |
DetectRange_Obstacle | FVector2f | (0, 150) | 障碍物检测距离(X: Min, Y: Max)——同为碰撞尺寸之外的扩展量,最终 = 身体半径 + Clamp(时间范围×速度, Min, Max)。Obstacle detection distance (X: Min, Y: Max) — likewise an extension beyond the collision size; final = BodyRadius + Clamp(TimeHorizon×Speed, Min, Max). |
BrakingRangeMult | float | 0.25f | 自然制动距离乘数,封顶 ORCA 求解器的最大反应范围,编辑器显示名 "Braking Range Mult":cap = 当前速度² / (2 × min(XY 加速度, XY 减速度)) × 此值 + 避障半径。默认 0.25 → 如 0-500 的制动范围变 0-125。仅当小于不封顶 DetectRange 距离时生效——取大值即不封顶。取 min 因 CMC 向非零目标降速受加速度钳制(减速度只管刹停)。按距离变速(SpeedRangeMapByDist)已隐式涵盖——cap 读当前速度。采集仍用完整 DetectRange_Agent(交通规则视野不变);仅封顶范围内邻居产生求解器约束。Multiplier on the natural braking distance that caps the ORCA solver's MAXIMUM reaction range; editor display name "Braking Range Mult": cap = CurrentSpeed² / (2 × min(XY Accel, XY Decel)) × this + AvoidRadius. Default 0.25 → e.g. a 0-500 braking range becomes 0-125. The cap engages only when smaller than the uncapped DetectRange distance — a large value means no cap. min() because CMC's velocity decline toward a NON-zero target is clamped by Acceleration (Deceleration only governs full stops). Distance speed ramps (SpeedRangeMapByDist) are covered implicitly — the cap reads the CURRENT speed. Gathering still uses full DetectRange_Agent (traffic rules keep their view); only capped-range neighbors produce solver constraints. |
bUseTrafficRules | bool | false | 所有交通规则的全局总闸。关闭后每条规则的独立开关均无效。默认关闭——打开即启用交通层(FTrafficShared 内各规则开关默认全开)。Global gate for all traffic rules. When false, every individual rule is bypassed regardless of its bEnable switch. Default OFF — enable to turn on the traffic layer (the FTrafficShared rule toggles themselves default ON). |
FAvoiding USTRUCT
避障运行时状态 fragment(FA_MassBattleBaseFragment 派生)。逐帧更新,非作者编辑,快照时恢复。避障处理器读取/写入,FAgentGridData 的填充源之一。
Avoidance runtime state fragment (derived from FA_MassBattleBaseFragment). Updated per frame, not authored, restored on snapshot. Read/written by the avoidance processors; one of the sources filling FAgentGridData.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
DesiredVelocity | FVector2f | (0, 0) | 期望速度(XY 平面)。Desired velocity (XY plane). |
CurrentVelocity | FVector2f | (0, 0) | 当前速度(XY 平面)。Current velocity (XY plane). |
AvoidingVelocity | FVector2f | (0, 0) | 避障后的最终速度。Final velocity after avoidance. |
invTimeHorizonAgent | float | 1.0f | Agent 时间视野的倒数(预计算,非 UPROPERTY)。Inverse of the agent time horizon (precomputed; not a UPROPERTY). |
invTimeHorizonObst | float | 1.0f | 障碍时间视野的倒数(预计算,非 UPROPERTY)。Inverse of the obstacle time horizon (precomputed; not a UPROPERTY). |
MaxSpeed | float | 0.0f | 当前最大速度限制。Current max speed limit. |
AvoidRadius | float | 100.0f | 避障半径(含本体半径)。Avoidance radius (body radius included). |
bCanAvoid | bool | true | 本帧是否可避障。Whether avoidance is allowed this frame. |
FCapsuleRVOData USTRUCT
RVO 求解用的胶囊邻居数据(非 fragment)。同一结构承载三类邻居:Agent(从 FAgentGridData 构造)、胶囊障碍物(FCapsuleObstGridData,恒按圆形处理 Major==Minor==Radius)、线段障碍物(FSegmentObstGridData,向量逻辑,全成员初始化)。位域压缩 2 字节(11 标志 + 5 空闲)。
Capsule neighbor data for the RVO solver (not a fragment). One struct serves three neighbor kinds: agents (from FAgentGridData), capsule obstacles (FCapsuleObstGridData, always treated as a circle: Major == Minor == Radius), and segment obstacles (FSegmentObstGridData, vector math, all members initialized). Bitfields pack 2 bytes (11 flags + 5 spare).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
UpVector | FVector3f | UpVector | 邻居的朝上向量。Neighbor's up vector. |
RelativePosition | FVector3f | Zero | 相对请求 Agent 的位置(构造时计算)。Position relative to the requesting agent (computed at construction). |
CurrentVelocity | FVector2f | (0, 0) | 邻居当前速度。Neighbor's current velocity. |
DesiredVelocity | FVector2f | (0, 0) | 邻居期望速度(仅 Agent 来源有值)。Neighbor's desired velocity (agent sources only). |
EntityHandle | FMassEntityHandle | — | 邻居实体句柄。Neighbor entity handle. |
UniqueID | int32 | -1 | 邻居唯一 ID(-1 = 无效);线段障碍来源填入 GroupID。Neighbor unique ID (-1 = invalid); segment-obstacle sources fill in the GroupID. |
DistSqr | float | 0 | 距离平方,用于排序。Squared distance, used for sorting. |
AvoidRadius | FVector2f | (100, 100) | 椭圆避障半径:X=主轴(沿胶囊轴 XY 投影),Y=副轴。Elliptical avoid radius: X = Major (along capsule shaft XY projection), Y = Minor. |
ColliderRadius | float | 50.f | 碰撞体半径。Collider radius. |
ColliderMult | float | 1.f | PBD 碰撞体缩放乘数(来自 FAgentGridData.ColliderMult)——膨胀接触边界,供回归 goal 占用的邻居判定使用,与网格探测语义镜像(站在该处即与占位者永久求解器接触)。障碍构造填中性值 1。PBD collider scale multiplier (from FAgentGridData.ColliderMult) — the inflated contact bound, read by the return goal-occupancy neighbor test to mirror the grid probe semantics (standing at the goal means permanent solver contact with the occupant). Obstacle constructors fill the neutral value 1. |
ColliderHeight | float | 100.f | 碰撞体高度。Collider height. |
Mass | float | 1.f | 质量(障碍物构造为 10000,视为不可移动)。Mass (obstacle constructors use 10000 — effectively immovable). |
DistToGoalSqrt | float | 0.f | 到目标距离(仅 Agent 来源有值,用于交通规则)。Distance to goal (agent sources only; used by traffic rules). |
AvoidWeight | float | 1.f | 逐对避让衰减(采集时由自身的 IgnoreGroupFlags + IgnoreGroupAlpha 计算):0 本不入列;1 = 正常;中间值求解器按此缩放约束强度(ORCA 合成半径、ForceField 斥力)。仅 scratch——不序列化。Per-pair avoidance attenuation (gather-computed from self's IgnoreGroupFlags + IgnoreGroupAlpha): 0 would have excluded the neighbor entirely (never admitted); 1 = normal; in between, the solvers scale their constraint strength (ORCA combined radius, ForceField repulsion). Scratch-only — never serialized. |
PathLateralDist | float | 0.f | 该邻居到其自身当前路径段所在直线的垂直距离(cm)——方向性责任规则输入。仅 bHasPathPolyline 置位时有效。Perpendicular distance (cm) from this neighbor to ITS OWN active path segment's line — directional-yield rule input. Valid only when bHasPathPolyline is set. |
bCanAvoid / bOverrideSpeedLimit / bIsCylinder / bIsObstacle / bIsDying | uint16 : 1 | 0 | 邻居标志:可避障 / 可覆盖限速 / 圆柱体 / 是否为障碍物 / 是否死亡中。Neighbor flags: can avoid / overrides speed limit / is cylinder / is obstacle / is dying. |
TrafficRank | uint16 : 2 | 0 | 交通优先级:0=Idle, 1=Returning, 2=Moving, 3=FarReturning(距 goal 超过 TR.Arbitration.ReturnPriorityDist 的回归者)。FarReturning(3) > Moving(2) > Returning(1) > Idle(0)——档位 3 仅次战斗、高于移动。Traffic priority: 0=Idle, 1=Returning, 2=Moving, 3=FarReturning (a returner beyond TR.Arbitration.ReturnPriorityDist). FarReturning(3) > Moving(2) > Returning(1) > Idle(0) — rank 3 sits below only combat's attacker flag, ABOVE Moving. |
bIsTouchingObst / bIsAvoidingObst / bIsAttacker / bHasPathPolyline | uint16 : 1 | 0 | 邻居接触障碍物(自身承担全部 RVO 责任)/ 邻居在避障(自身承担更多责任)/ 邻居攻击状态(门控攻击者间划分)/ 邻居有真实路径折线(非 goal 方向 fallback,对称门控方向性责任规则)。Neighbor in obstacle contact (self takes full RVO responsibility) / neighbor avoiding obstacles (self takes more responsibility) / neighbor attacking (gates attacker-vs-attacker split) / neighbor has a REAL path polyline (not the goal-direction fallback; gates the directional yield rule symmetrically). |
方法 Methods
从 Agent 网格数据构造:相对位置 = (网格单元位置 + Agent 相对位置) − 请求 Agent 位置。默认 bOverrideSpeedLimit=false(Agent 通常不覆盖他人限速),并钉死 bIsCylinder=false、bIsObstacle=false(agent 条目绝不是障碍——goal 空间判定与压力场门控逐帧分支读 bIsObstacle,回收 scratch 槽位的残留脏位会不确定地跳过真实邻居,双端分配历史不同即失步,2026-08-26 根因)。
Constructs from agent grid data: relative position = (grid cell location + agent relative location) − requesting agent location. Defaults bOverrideSpeedLimit=false (agents typically don't override others' speed limits) and pins bIsCylinder=false, bIsObstacle=false (agent entries are NEVER obstacles — the return goal-space test and the pressure-field gate branch on bIsObstacle every frame; an indeterminate bit from recycled scratch slots skips real agent neighbors nondeterministically, and differing per-process allocation history across peers desyncs — root cause, 2026-08-26).
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
InGridData | const FAgentGridData& | 邻居 Agent 的网格数据。Neighbor agent's grid data. |
InGridCellLocation | const FVector& | 邻居所在网格单元的世界位置。World location of the neighbor's grid cell. |
RequestingAgentLocation | const FVector& | 请求避障的 Agent 的世界位置。World location of the requesting agent. |
InDistSqr | float | 距离平方。Squared distance. |
Output
无返回值。副作用:填充全部字段。
No return value. Side effect: all fields filled.
从胶囊障碍网格数据构造:避障半径恒按圆形(Major == Minor == Radius)、bIsObstacle=true、质量 10000。全成员初始化(锁步规则):UniqueID 取生成时已赋的真实 UID(ObstSubsystem 生成路径)——堆平局裁决读真实 UID 而非残留位;TrafficRank=0(障碍绝非转场单位)、AvoidWeight=1(全额约束强度)、ColliderMult=1(中性——障碍接触直接用 Radius)。
Constructs from capsule obstacle grid data: avoid radius always circular (Major == Minor == Radius), bIsObstacle=true, mass 10000. Full member initialization (lockstep rule): UniqueID takes the real spawn-assigned UID (the ObstSubsystem spawn path) — the heap tie-break reads a real UID, not residue; TrafficRank=0 (obstacles are never transit agents), AvoidWeight=1 (full constraint strength), ColliderMult=1 (neutral — obstacle contact uses Radius directly).
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
InObstData | const FCapsuleObstGridData& | 胶囊障碍网格数据。Capsule obstacle grid data. |
InGridCellLocation | const FVector& | 障碍所在网格单元的世界位置。World location of the obstacle's grid cell. |
RequestingAgentLocation | const FVector& | 请求避障的 Agent 的世界位置。World location of the requesting agent. |
Output
无返回值。副作用:填充全部字段。
No return value. Side effect: all fields filled.
从线段障碍网格数据构造:逻辑使用向量数学,全成员初始化(UpVector 恒为世界 Up、UniqueID 填入 GroupID、避障半径 = center 到 point 距离、质量 10000 与胶囊构造同款不可推动约定、TrafficRank=0、AvoidWeight=1)。
Constructs from segment obstacle grid data: logic uses vector math, all members initialized (UpVector always world Up, UniqueID filled from GroupID, avoid radius = distance from center to point, mass 10000 with the same immovable convention as the capsule ctor, TrafficRank=0, AvoidWeight=1).
Input
| 参数 Param | 类型 Type | 说明 Description |
|---|---|---|
InObstData | const FSegmentObstGridData& | 线段障碍网格数据。Segment obstacle grid data. |
RequestingAgentLocation | const FVector& | 请求避障的 Agent 的世界位置。World location of the requesting agent. |
Output
无返回值。副作用:填充全部字段。
No return value. Side effect: all fields filled.
按 EntityHandle 比较相等;哈希亦基于 EntityHandle。
Equality by EntityHandle; hash is based on EntityHandle too.
Input
一个待比较对象(或 uint32 哈希值)。
A comparable object (or a uint32 hash).
Output
返回是否相等 / 哈希值。无副作用。
Returns equality / hash. No side effects.
FSegmentObstPointRVOData USTRUCT
线段障碍端点数据(非 fragment):端点位置、单位方向与凸性标志。
Segment-obstacle endpoint data (not a fragment): endpoint position, unit direction and convexity flag.
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
point_ | FVector2f | (0, 0) | 端点位置(XY)。Endpoint position (XY). |
unitDir_ | FVector2f | (1, 0) | 单位方向。Unit direction. |
isConvex_ | bool | true | 该端点是否为凸角。Whether the endpoint is a convex corner. |
FSegmentObstRVOData USTRUCT
线段障碍的 RVO 求解数据(非 fragment),从 FSegmentObstGridData 构造,含两个端点(point/nextPoint)。
Segment-obstacle RVO solver data (not a fragment), constructed from FSegmentObstGridData, holding two endpoints (point/nextPoint).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
EntityHandle | FMassEntityHandle | — | 障碍实体句柄。Obstacle entity handle. |
GroupID | uint32 | 0 | 组 ID(多线段障碍组)。Group ID (multi-segment obstacle group). |
Index | int32 | 0 | 组内索引。Index within the group. |
center | FVector2f | (0, 0) | 线段中心(XY)。Segment center (XY). |
pointZ | float | 0 | 线段基准高度 Z。Segment base height Z. |
height | float | 0 | 线段高度。Segment height. |
DistSqr | float | 0 | 距离平方(供排序)。Squared distance (for sorting). |
point / nextPoint | FSegmentObstPointRVOData | — | 两个端点数据。The two endpoint data. |
FBoxObstRVOData USTRUCT
盒子障碍的 RVO 求解数据(非 fragment),从 FBoxObstGridData 构造,附带邻居收集阶段预计算的 OBB 碰撞缓存(ClosestPointOnOBB / SurfaceNormal / DistanceToOBB)。
Box-obstacle RVO solver data (not a fragment), constructed from FBoxObstGridData, carrying precomputed OBB collision cache from the neighbor-gather phase (ClosestPointOnOBB / SurfaceNormal / DistanceToOBB).
成员变量 Members
| 名称 Name | 类型 Type | 默认值 | 说明 Description |
|---|---|---|---|
EntityHandle / UniqueID | FMassEntityHandle / int32 | — / -1 | 障碍实体句柄与唯一 ID。Obstacle entity handle and unique ID. |
RelativeCenter | FVector3f | Zero | OBB 中心相对请求 Agent 的位置。OBB center relative to the requesting agent. |
Orientation | FQuat | Identity | OBB 朝向。OBB orientation. |
HalfExtents | FVector | (50, 50, 50) | OBB 半尺寸。OBB half extents. |
Velocity | FVector2f | (0, 0) | 障碍速度。Obstacle velocity. |
ClosestPointOnOBB | FVector | Zero | OBB 上距离请求 Agent 最近的点(收集阶段计算)。Closest point on the OBB to the requesting agent (computed at gather). |
SurfaceNormal | FVector | Zero | 接触点表面法线。Surface normal at the contact point. |
DistanceToOBB | float | 0 | 到 OBB 的距离(已减自身半径)。Distance to the OBB (self radius subtracted). |
DistSqr | float | 0 | 距离平方(供排序)。Squared distance (for sorting). |
bOverrideSpeedLimit / bInsideOut / bIsInside | uint8 : 1 | 0 | 可覆盖限速 / 反向构造(面内朝外) / 请求 Agent 是否在盒内。Overrides speed limit / inside-out construction / whether the requesting agent is inside the box. |
管线角色 Pipeline Role
FAvoidance / FAvoiding 由移动处理器(grep 验证:MassBattleAgentMoveProcessor、MassBattleAgentMoveProcessorFP、MassBattleGridUpdateProcessor、MassBattleAgentSubsystem、MassBattleObstSubsystem)消费:避障求解器读取邻居网格数据构造 FCapsuleRVOData 等载体,输出 AvoidingVelocity 供移动积分使用;FAvoiding 在快照恢复时还原(非作者编辑)。
FAvoidance / FAvoiding are consumed by the movement processors (verified by grep: MassBattleAgentMoveProcessor, MassBattleAgentMoveProcessorFP, MassBattleGridUpdateProcessor, MassBattleAgentSubsystem, MassBattleObstSubsystem): the avoidance solver builds FCapsuleRVOData etc. from neighbor grid data and outputs AvoidingVelocity for movement integration; FAvoiding is restored on snapshot (not authored).