godot-tank-test/assets/scripts/ammo/round_autocannon.gd
2024-08-03 18:33:20 +03:00

23 lines
568 B
GDScript

extends RigidBody3D
var life_span = 0
# Called when the node enters the scene tree for the first time.
func _ready():
set_contact_monitor(true)
set_max_contacts_reported(5)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
life_span += delta
if life_span > 5:
print("removed shot")
queue_free()
func init_round(start:Node3D, aim_vec:Vector3):
position = start.global_position
transform.basis = start.global_transform.basis
#print(start.target_position)
set_linear_velocity(aim_vec.normalized() * 200.0)