GFSteeringAgent¶
API Reference / Standard / 类索引
- 路径:
addons/gf/standard/foundation/math/gf_steering_agent.gd - 模块:
Standard - 继承:
RefCounted - API:
public - 类别:值对象 (
value_object) - 首次版本:
3.17.0
steering 计算使用的通用代理状态。 只描述位置、速度、朝向和运动上限,不持有 Node 或物理体。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 属性 | position |
var position: Vector3 = Vector3.ZERO |
| 属性 | velocity |
var velocity: Vector3 = Vector3.ZERO |
| 属性 | orientation |
var orientation: float = 0.0 |
| 属性 | angular_velocity |
var angular_velocity: float = 0.0 |
| 属性 | radius |
var radius: float = 8.0 |
| 属性 | linear_speed_max |
var linear_speed_max: float = 240.0 |
| 属性 | linear_acceleration_max |
var linear_acceleration_max: float = 800.0 |
| 属性 | angular_speed_max |
var angular_speed_max: float = TAU |
| 属性 | angular_acceleration_max |
var angular_acceleration_max: float = TAU * 4.0 |
| 方法 | set_from_node_2d |
func set_from_node_2d(node: Node2D, linear_velocity: Vector2 = Vector2.ZERO) -> void: |
| 方法 | set_from_node_3d |
func set_from_node_3d(node: Node3D, linear_velocity: Vector3 = Vector3.ZERO) -> void: |
| 方法 | duplicate_agent |
func duplicate_agent() -> GFSteeringAgent: |
属性¶
position¶
- API:
public
当前世界位置。2D 项目可使用 x/y,z 保持 0。
velocity¶
- API:
public
当前线性速度。2D 项目可使用 x/y,z 保持 0。
orientation¶
- API:
public
当前朝向角,单位为弧度。
angular_velocity¶
- API:
public
当前角速度,单位为弧度每秒。
radius¶
- API:
public
代理半径,用于邻域或避让计算。
linear_speed_max¶
- API:
public
最大线性速度。
linear_acceleration_max¶
- API:
public
最大线性加速度。
angular_speed_max¶
- API:
public
最大角速度。
angular_acceleration_max¶
- API:
public
最大角加速度。
方法¶
set_from_node_2d¶
- API:
public
从 Node2D 同步位置与朝向。
参数:
| 名称 | 说明 |
|---|---|
node |
目标 Node2D。 |
linear_velocity |
可选线性速度。 |
set_from_node_3d¶
- API:
public
从 Node3D 同步位置与朝向。
参数:
| 名称 | 说明 |
|---|---|
node |
目标 Node3D。 |
linear_velocity |
可选线性速度。 |
duplicate_agent¶
- API:
public
创建深拷贝。
返回:新代理状态。