extends Camera3D
var target_rotation = PI / 2 # Ángulo de rotación objetivo (90 grados en radianes)
var current_rotation = 0.0
var rotation_speed = 0.1 # Ajusta esta variable para cambiar la velocidad de rotación
var is_rotating_forward = true # Indica si la rotación es en sentido horario (true) o antihorario (false)
func _process(delta: float) -> void:
if is_rotating_forward:
if current_rotation < target_rotation:
rotate_y(delta * rotation_speed)
current_rotation += delta * rotation_speed
if current_rotation >= target_rotation:
current_rotation = target_rotation
is_rotating_forward = false # Cambiar dirección de rotación
else:
if current_rotation > -target_rotation:
rotate_y(-delta * rotation_speed)
current_rotation -= delta * rotation_speed
if current_rotation <= -target_rotation:
current_rotation = -target_rotation
is_rotating_forward = true # Cambiar dirección de rotación