class_name PlayerProjectile extends Area3D const SPEED := 20. var _initialized := false var velocity: Vector3 func _ready() -> void: body_entered.connect(func(body: Node3D): if body.has_method("hit"): body.hit(self) queue_free() ) func init(dir: Vector3) -> void: _initialized = true velocity = dir * SPEED func _physics_process(delta: float) -> void: position += velocity * delta func _process(_delta: float) -> void: assert(_initialized)