extends Camera3D

@export var height: float = 18.0
@export var horizontal_distance: float = 18.0
@export var horizontal_angle_deg: float = 45.0
@export var ortho_size: float = 15.0

func _ready() -> void:
	set_as_top_level(true)
	projection = PROJECTION_ORTHOGONAL
	size = ortho_size

func _process(_delta: float) -> void:
	var angle_rad := deg_to_rad(horizontal_angle_deg)
	var offset := Vector3(
		sin(angle_rad) * horizontal_distance,
		height,
		cos(angle_rad) * horizontal_distance,
	)
	var target := get_parent() as Node3D
	global_position = target.global_position + offset
	look_at(target.global_position, Vector3.UP)
