mtd/Scripts/cinema_cam.gd

26 lines
721 B
GDScript3
Raw Permalink Normal View History

2024-02-22 06:22:22 +11:00
class_name CinematicCamManager extends Node3D
2023-11-19 18:47:52 +11:00
2024-02-22 06:22:22 +11:00
@export var path_follows: Array[PathFollow3D]
@export var cameras: Array[Camera3D]
@export var pan_speed: float = 1.0
var current_cam: int = 0
var does_its_thing: bool = true
2023-11-19 18:47:52 +11:00
func _ready() -> void:
2024-02-22 06:22:22 +11:00
for path_follow: PathFollow3D in path_follows:
2023-11-19 18:47:52 +11:00
path_follow.progress_ratio = 0.0
if does_its_thing:
cameras[0].make_current()
func _process(delta: float) -> void:
if does_its_thing:
path_follows[current_cam].progress_ratio += pan_speed * delta
if path_follows[current_cam].progress_ratio >= 1.0:
current_cam += 1
if current_cam >= cameras.size():
current_cam = 0
path_follows[current_cam].progress_ratio = 0.0
cameras[current_cam].make_current()