extends Camera3D

@onready var game = get_parent()
@onready var camera_zones = game.get_node("CameraZones")
@onready var player = game.get_node("Player")
@onready var offset = position - player.position

func _ready() -> void:
	pass

func _process(delta: float) -> void:
	var goal_position = player.get_node("Collision").global_position + offset
	global_position += (goal_position - global_position) / (500 * delta)
	
	for n in camera_zones.get_children():
		if player in n.get_overlapping_bodies():
			offset = n.get_node("Offset/Camera").position
			rotation = n.get_node("Offset/Camera").rotation
