跳转至

GFLinearProjectileMotion

API Reference / Combat / 类索引

  • 路径:addons/gf/extensions/combat/projectiles/gf_linear_projectile_motion.gd
  • 模块:Combat
  • 继承:GFProjectileMotion
  • API:public
  • 类别:资源定义 (resource_definition)
  • 首次版本:3.17.0

2D/3D 通用直线发射体移动策略。 该策略只处理线性位移,不处理碰撞、伤害、生命周期或目标选择。

成员概览

类型 名称 签名
属性 speed var speed: float = 0.0
属性 direction_2d var direction_2d: Vector2 = Vector2.RIGHT
属性 direction_3d var direction_3d: Vector3 = Vector3.FORWARD
属性 use_local_direction var use_local_direction: bool = true
属性 normalize_direction var normalize_direction: bool = true
方法 _step func _step(projectile: Node, delta: float, projectile_context: Dictionary = {}) -> void:

属性

speed

  • API:public
var speed: float = 0.0

每秒移动距离。

direction_2d

  • API:public
var direction_2d: Vector2 = Vector2.RIGHT

2D 方向。use_local_direction 为 true 时按发射体当前变换转换。

direction_3d

  • API:public
var direction_3d: Vector3 = Vector3.FORWARD

3D 方向。use_local_direction 为 true 时按发射体当前变换转换。

use_local_direction

  • API:public
var use_local_direction: bool = true

是否把方向视为发射体本地坐标。

normalize_direction

  • API:public
var normalize_direction: bool = true

是否归一化方向。

方法

_step

  • API:protected
func _step(projectile: Node, delta: float, projectile_context: Dictionary = {}) -> void:

推进直线移动。

参数:

名称 说明
projectile 发射体节点。
delta 物理帧间隔。
projectile_context 本次发射上下文字典。

结构:

  • projectile_context: Dictionary,本次发射上下文;会写入 velocity_2d 或 velocity_3d。