open-strike-2/scenes/weapon/guns/ak/bullet.gd

26 lines
575 B
GDScript

extends Node3D
const SPEED = 715
@onready var mesh = $Object_10
@onready var trace = $Trace
# 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):
position += transform.basis * Vector3(0, 0, SPEED) * delta
trace.collision_mask = 1
trace.enabled = 1
if trace.is_colliding():
mesh.visible = false
await get_tree().create_timer(1.0).timeout
queue_free()
func _on_timer_timeout():
queue_free()