Fix: Sistema de convergencia y flip timing en LOGO mode

Refactoring semántico:
- Renombrar rotoball_* → shape_* (variables y métodos)
- Mejora legibilidad: aplica a todas las figuras 3D, no solo esfera

Fixes críticos:
- Fix convergencia: setShapeTarget2D() actualiza targets cada frame
- Fix getDistanceToTarget(): siempre calcula distancia (sin guarda)
- Fix lógica flip: destruir DURANTE flip N (no después de N flips)
- Añadir display CONV en debug HUD (monitoreo convergencia)

Mejoras timing:
- Reducir PNG_IDLE_TIME_LOGO: 3-5s → 2-4s (flips más dinámicos)
- Bajar CONVERGENCE_THRESHOLD: 0.8 → 0.4 (40% permite flips)

Sistema flip-waiting (LOGO mode):
- CAMINO A: Convergencia + tiempo (inmediato)
- CAMINO B: Esperar 1-3 flips y destruir durante flip (20-80% progreso)
- Tracking de flips con getFlipCount() y getFlipProgress()

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-09 11:01:41 +02:00
parent 6cb3c2eef9
commit b93028396a
8 changed files with 238 additions and 52 deletions

View File

@@ -22,12 +22,12 @@ class Ball {
bool on_surface_; // Indica si la pelota est\u00e1 en la superficie (suelo/techo/pared)
float loss_; // Coeficiente de rebote. Pérdida de energía en cada rebote
// Datos para modo RotoBall (esfera 3D)
float pos_3d_x_, pos_3d_y_, pos_3d_z_; // Posición 3D en la esfera
// Datos para modo Shape (figuras 3D)
float pos_3d_x_, pos_3d_y_, pos_3d_z_; // Posición 3D en la figura
float target_x_, target_y_; // Posición destino 2D (proyección)
float depth_brightness_; // Brillo según profundidad Z (0.0-1.0)
float depth_scale_; // Escala según profundidad Z (0.5-1.5)
bool rotoball_attraction_active_; // ¿Está siendo atraída hacia la esfera?
bool shape_attraction_active_; // ¿Está siendo atraída hacia la figura?
public:
// Constructor
@@ -80,22 +80,22 @@ class Ball {
void updateSize(int new_size); // Actualizar tamaño de hitbox
void setTexture(std::shared_ptr<Texture> texture); // Cambiar textura del sprite
// Funciones para modo RotoBall
void setRotoBallPosition3D(float x, float y, float z);
void setRotoBallTarget2D(float x, float y);
void setRotoBallScreenPosition(float x, float y); // Establecer posición directa en pantalla
// Funciones para modo Shape (figuras 3D)
void setShapePosition3D(float x, float y, float z);
void setShapeTarget2D(float x, float y);
void setShapeScreenPosition(float x, float y); // Establecer posición directa en pantalla
void setDepthBrightness(float brightness);
float getDepthBrightness() const { return depth_brightness_; }
void setDepthScale(float scale);
float getDepthScale() const { return depth_scale_; }
// Sistema de atracción física hacia figuras 3D
void enableRotoBallAttraction(bool enable);
void enableShapeAttraction(bool enable);
float getDistanceToTarget() const; // Distancia actual al punto objetivo
void applyRotoBallForce(float target_x, float target_y, float sphere_radius, float deltaTime,
float spring_k = SHAPE_SPRING_K,
float damping_base = SHAPE_DAMPING_BASE,
float damping_near = SHAPE_DAMPING_NEAR,
float near_threshold = SHAPE_NEAR_THRESHOLD,
float max_force = SHAPE_MAX_FORCE);
void applyShapeForce(float target_x, float target_y, float sphere_radius, float deltaTime,
float spring_k = SHAPE_SPRING_K,
float damping_base = SHAPE_DAMPING_BASE,
float damping_near = SHAPE_DAMPING_NEAR,
float near_threshold = SHAPE_NEAR_THRESHOLD,
float max_force = SHAPE_MAX_FORCE);
};