extends Camera3D
var target_rotation_x = PI / 2 # Ángulo de rotación objetivo en el eje X
var target_rotation_y = PI / 4 # Ángulo de rotación objetivo en el eje Y
var current_rotation_x = 0.0
var current_rotation_y = 0.0
var rotation_speed = 0.7 # Ajusta esta variable para cambiar la velocidad de rotación
var is_rotating_forward_x = true # Indica si la rotación en X es en sentido horario
var is_rotating_forward_y = false # Indica si la rotación en Y es en sentido horario
func _process(delta: float) -> void:
# Rotación en el eje X
if is_rotating_forward_x:
if current_rotation_x < target_rotation_x:
rotate_x(delta * rotation_speed)
current_rotation_x += delta * rotation_speed
if current_rotation_x >= target_rotation_x:
current_rotation_x = target_rotation_x
is_rotating_forward_x = false
else:
if current_rotation_x > -target_rotation_x:
rotate_x(-delta * rotation_speed)
current_rotation_x -= delta * rotation_speed
if current_rotation_x <= -target_rotation_x:
current_rotation_x = -target_rotation_x
is_rotating_forward_x = true
# Rotación en el eje Y
if is_rotating_forward_y:
if current_rotation_y < target_rotation_y:
rotate_y(delta * rotation_speed)
current_rotation_y += delta * rotation_speed
if current_rotation_y >= target_rotation_y:
current_rotation_y = target_rotation_y
is_rotating_forward_y = false
else:
if current_rotation_y > -target_rotation_y:
rotate_y(-delta * rotation_speed)
current_rotation_y -= delta * rotation_speed
if current_rotation_y <= -target_rotation_y:
current_rotation_y = -target_rotation_y
is_rotating_forward_y = true
No hay comentarios:
Publicar un comentario