20 lines
467 B
GDScript
20 lines
467 B
GDScript
class_name Particles3DSelfDestructing extends GPUParticles3D
|
|
|
|
|
|
func _ready() -> void:
|
|
emitting = true
|
|
for node in get_children():
|
|
if node is GPUParticles3D:
|
|
(node as GPUParticles3D).emitting = true
|
|
finished.connect(_on_finished)
|
|
|
|
|
|
func init(start_position: Vector3, direction: Vector3 = Vector3.ZERO) -> void:
|
|
global_position = start_position
|
|
if direction != Vector3.ZERO:
|
|
look_at(global_position + direction)
|
|
|
|
|
|
func _on_finished() -> void:
|
|
queue_free()
|