class_name Bullet extends Area3D

var speed = 2
signal hit(bullet, body)

func setSpeed(speedVal):
	speed = speedVal
	
func _physics_process(delta):
	#three approaches:
	#1. update position with a vector3
	#position += Vector3(speed * delta, 0, 0)
	#2. update the transform
	#global_transform.origin += transform.basis.x.normalized() * speed * delta
	#3. calculate the vector of intended direction
	var velocity_vector = transform.basis.x * speed
	position += velocity_vector * delta


func _on_body_entered(body: Node3D) -> void:
	print("bullet hit a thing")
	hit.emit(self, body)
