26 lines
790 B
GDScript3
Raw Normal View History

2024-01-16 22:01:16 +00:00
extends Camera3D
2024-02-05 09:36:26 +00:00
@export var follow: Node3D
@export var pivot: Node3D
2024-01-16 22:01:16 +00:00
@export var follow_speed: float
func _ready():
Global.camera = self
2024-02-05 09:36:26 +00:00
look_at(pivot.position)
2024-01-16 22:01:16 +00:00
func _process(delta):
2024-01-17 20:48:35 +00:00
if Global.player == null:
return
2024-02-05 09:36:26 +00:00
follow.position = lerp(follow.position, Global.player.position, follow_speed * delta)
2024-01-16 22:01:16 +00:00
2024-01-17 20:48:35 +00:00
# @export var shake_strength: float
# var noise = FastNoiseLite.new()
2024-01-16 22:01:16 +00:00
# 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)