File size: 473 Bytes
b1e4a8e e22408d b1e4a8e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
extends Camera3D
@export var lerp_speed = 3.0
@export_node_path("VehicleBody3D") var target_path
@export var offset := Vector3.ZERO
var target = null
func _ready():
target = get_node(target_path)
func _physics_process(delta):
if target == null:
return
var target_pos = target.global_transform.translated_local(offset)
global_transform = global_transform.interpolate_with(target_pos, lerp_speed * delta)
look_at(target.global_transform.origin, Vector3.UP)
|