26 lines
790 B
GDScript

extends Camera3D
@export var follow: Node3D
@export var pivot: Node3D
@export var follow_speed: float
func _ready():
Global.camera = self
look_at(pivot.position)
func _process(delta):
if Global.player == null:
return
follow.position = lerp(follow.position, Global.player.position, follow_speed * delta)
# @export var shake_strength: float
# var noise = FastNoiseLite.new()
# func shake(time):
# var trauma_sq := 1.0
# var h_offset := noise.get_noise_2d(time, 0) * trauma_sq * shake_strength
# var v_offset := noise.get_noise_2d(time, 1) * trauma_sq * shake_strength
# rotate_x(noise.get_noise_2d(time, 2) * trauma_sq * shake_strength)
# rotate_y(noise.get_noise_2d(time, 3) * trauma_sq * shake_strength)
# rotate_z(noise.get_noise_2d(time, 4) * trauma_sq * shake_strength)