Mejoras animaciones 3D: tumbling en cilindro + pivoteo en wave grid

- **CylinderShape**: Añadido sistema de tumbling ocasional
  - Volteretas de 90° en eje X cada 3-5 segundos
  - Interpolación suave con ease-in-out (1.5s)
  - Rotación Y continua + tumbling X ocasional = más dinámico

- **WaveGridShape**: Reemplazada rotación por pivoteo sutil
  - Eliminada rotación completa en eje Y
  - Pivoteo en esquinas (oscilación lenta 0.3/0.5 rad/s)
  - Grid paralelo a pantalla con efecto "sábana ondeando"
  - Ondas sinusoidales + pivoteo = movimiento más orgánico

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 11:14:29 +02:00
parent af3274e9bc
commit 2ae515592d
4 changed files with 77 additions and 22 deletions

View File

@@ -34,8 +34,10 @@ void WaveGridShape::update(float delta_time, float screen_width, float screen_he
grid_size_ = screen_height * WAVE_GRID_SIZE_FACTOR;
amplitude_ = screen_height * WAVE_GRID_AMPLITUDE;
// Actualizar rotación en eje Y (horizontal)
angle_y_ += WAVE_GRID_ROTATION_SPEED_Y * delta_time;
// Pivoteo sutil en ejes X e Y (esquinas adelante/atrás, izq/der)
// Usamos velocidades lentas para movimiento sutil y orgánico
tilt_x_ += 0.3f * delta_time; // Pivoteo vertical (esquinas arriba/abajo)
tilt_y_ += 0.5f * delta_time; // Pivoteo horizontal (esquinas izq/der)
// Actualizar fase de las ondas (animación)
phase_ += WAVE_GRID_PHASE_SPEED * delta_time;
@@ -70,18 +72,22 @@ void WaveGridShape::getPoint3D(int index, float& x, float& y, float& z) const {
// z = amplitude * sin(frequency * x + phase) * cos(frequency * y + phase)
float kx = WAVE_GRID_FREQUENCY * PI; // Frecuencia en X
float ky = WAVE_GRID_FREQUENCY * PI; // Frecuencia en Y
float z_base = amplitude_ * sinf(kx * u + phase_) * cosf(ky * v + phase_);
float z_wave = amplitude_ * sinf(kx * u + phase_) * cosf(ky * v + phase_);
// Aplicar rotación en eje Y (horizontal)
float cos_y = cosf(angle_y_);
float sin_y = sinf(angle_y_);
float x_rot = x_base * cos_y - z_base * sin_y;
float z_rot = x_base * sin_y + z_base * cos_y;
// Añadir pivoteo sutil: esquinas se mueven adelante/atrás según posición
// tilt_x oscila esquinas arriba/abajo, tilt_y oscila esquinas izq/der
float tilt_amount_x = sinf(tilt_x_) * 0.15f; // Máximo 15% del grid_size
float tilt_amount_y = sinf(tilt_y_) * 0.1f; // Máximo 10% del grid_size
// Retornar coordenadas finales
x = x_rot;
float z_tilt = (u * tilt_amount_y + v * tilt_amount_x) * grid_size_;
// Z final = ondas + pivoteo
float z_final = z_wave + z_tilt;
// Retornar coordenadas (grid paralelo a pantalla, sin rotación global)
x = x_base;
y = y_base;
z = z_rot;
z = z_final;
}
float WaveGridShape::getScaleFactor(float screen_height) const {