2025-01-16 14:20:04 +00:00
|
|
|
extends Node3D
|
|
|
|
|
|
|
|
const SPEED = 100
|
|
|
|
|
|
|
|
@onready var mesh = $MeshInstance3D
|
|
|
|
@onready var ray = $RayCast3D
|
|
|
|
@onready var particles = $GPUParticles3D
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready() -> void:
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta):
|
2025-01-25 08:03:06 +00:00
|
|
|
print("bullet:")
|
|
|
|
position += transform.basis * Vector3(0, 0, SPEED) * delta
|
2025-01-16 14:20:04 +00:00
|
|
|
ray.collision_mask = 1
|
|
|
|
ray.enabled = 1
|
|
|
|
if ray.is_colliding():
|
|
|
|
mesh.visible = false
|
|
|
|
particles.emitting = true
|
|
|
|
await get_tree().create_timer(1.0).timeout
|
|
|
|
queue_free()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
queue_free()
|