diff --git a/Simulacion/BEPU.cs b/Simulacion/BEPU.cs index 5b6c272..0f0bd5c 100644 --- a/Simulacion/BEPU.cs +++ b/Simulacion/BEPU.cs @@ -140,7 +140,7 @@ namespace CtrEditor.Simulacion botella.CreateOrUpdateMotor(transport, direction, speed); //Fricción alta para transportes - pairMaterial.FrictionCoefficient = 0.3f; + pairMaterial.FrictionCoefficient = 0.01f; pairMaterial.MaximumRecoveryVelocity = 1f; pairMaterial.SpringSettings = new SpringSettings(80, 6); } @@ -151,11 +151,10 @@ namespace CtrEditor.Simulacion // ✅ CREAR O ACTUALIZAR MOTOR DINÁMICO INMEDIATAMENTE var direction = _simulationManager.CalculateCurveDirectionFromBottlePosition(curve, botella); - var speed = curve.SpeedMetersPerSecond; // ✅ CORREGIDO: Usar SpeedMetersPerSecond como simTransporte - botella.CreateOrUpdateMotor(curve, direction, speed); + botella.CreateOrUpdateMotor(curve, direction, curve.Speed); // Fricción alta para curvas - pairMaterial.FrictionCoefficient = 0.3f; + pairMaterial.FrictionCoefficient = 0.01f; pairMaterial.MaximumRecoveryVelocity = 1f; pairMaterial.SpringSettings = new SpringSettings(80, 6); } @@ -163,14 +162,14 @@ namespace CtrEditor.Simulacion else if (botella != null && (GetGuiaFromCollidable(pair.A) != null || GetGuiaFromCollidable(pair.B) != null)) { // Configuración específica para guías usando propiedades configurables - pairMaterial.FrictionCoefficient = 0.3f; + pairMaterial.FrictionCoefficient = 0.01f; pairMaterial.MaximumRecoveryVelocity = 1f; pairMaterial.SpringSettings = new SpringSettings(80, 6); } // Ajustes básicos para otras botellas else if (botella != null) { - pairMaterial.FrictionCoefficient = 0.3f; + pairMaterial.FrictionCoefficient = 0.01f; pairMaterial.MaximumRecoveryVelocity = 1f; pairMaterial.SpringSettings = new SpringSettings(80, 6); } diff --git a/Simulacion/simBase.cs b/Simulacion/simBase.cs index 6bef779..7faa89b 100644 --- a/Simulacion/simBase.cs +++ b/Simulacion/simBase.cs @@ -17,7 +17,10 @@ namespace CtrEditor.Simulacion protected SimulationManagerBEPU _simulationManager; // ✅ NUEVO: Referencia al manager // ✅ CORREGIDO: Restaurar factor de conversión correcto - public const float SPEED_CONVERSION_FACTOR = 1.55f; // Factor de conversión de velocidad interna a m/s - Para LinearAxisMotor es 0.5f + static public float SpeedConversionFactor + { + get => 60f; // Factor de conversión de velocidad interna a m/s + } // Constantes para las posiciones Z de los objetos 3D public const float zPos_Transporte = 0f; // Z de la parte baja diff --git a/Simulacion/simBotella.cs b/Simulacion/simBotella.cs index 92e3c42..2615412 100644 --- a/Simulacion/simBotella.cs +++ b/Simulacion/simBotella.cs @@ -194,14 +194,14 @@ namespace CtrEditor.Simulacion else { // ✅ MISMO OBJETO: Solo actualizar velocidad - UpdateMotorSpeed(direction, speed / simBase.SPEED_CONVERSION_FACTOR); + UpdateMotorSpeed(direction, speed / simBase.SpeedConversionFactor); return; } // ✅ CREAR NUEVO MOTOR SI ES NECESARIO if (needsNewMotor && target != null) { - CreateMotorForTarget(target, direction, speed / simBase.SPEED_CONVERSION_FACTOR); + CreateMotorForTarget(target, direction, speed / simBase.SpeedConversionFactor); } } catch (Exception ex) @@ -247,7 +247,7 @@ namespace CtrEditor.Simulacion LocalOffsetB = Vector3.Zero, // Botella LocalAxis = tangentDir, // ✅ CORREGIDO: Usar la dirección tangencial calculada TargetVelocity = speed, // ✅ CORREGIDO: Usar la velocidad directamente - Settings = new MotorSettings(Math.Max(_mass * 20f, 8f), 4f) + Settings = new MotorSettings(Math.Max(_mass * 20f, 8f), 0f) }; // ✅ CONECTAR BOTELLA CON EL TARGET (transporte o curva) diff --git a/Simulacion/simCurve.cs b/Simulacion/simCurve.cs index ac56a8d..e399c6a 100644 --- a/Simulacion/simCurve.cs +++ b/Simulacion/simCurve.cs @@ -35,10 +35,6 @@ namespace CtrEditor.Simulacion // ✅ EVENTO para actualización de motores public event Action OnSpeedChanged; - // ✅ NUEVO: Propiedad para velocidad convertida (similar a simTransporte) - public float SpeedMetersPerSecond { get; private set; } - - // ✅ NUEVO: Almacenar triángulos creados para acceso directo private Triangle[] _storedTriangles; @@ -68,29 +64,15 @@ namespace CtrEditor.Simulacion // ✅ SIMPLIFICADO: Crear la curva directamente Create(innerRadius, outerRadius, startAngle, endAngle, topLeft, 0); - - // ✅ NUEVO: Inicializar SpeedMetersPerSecond - SpeedMetersPerSecond = Speed / simBase.SPEED_CONVERSION_FACTOR; } // ✅ SIMPLIFICADO: Configurar velocidad angular para AngularAxisMotor public void SetSpeed(float speed) { Speed = speed; // Velocidad angular directa (sin inversión) - SpeedMetersPerSecond = Speed / simBase.SPEED_CONVERSION_FACTOR; // ✅ NUEVO: Calcular velocidad convertida OnSpeedChanged?.Invoke(this); } - /// - /// ✅ NUEVO: Configura la velocidad de la curva en metros por segundo - /// Valores positivos mueven en sentido horario, negativos en sentido antihorario - /// - /// Velocidad en m/s (típicamente entre -5.0 y 5.0) - public void SetCurveSpeed(float speedMeterPerSecond) - { - SetSpeed(speedMeterPerSecond * simBase.SPEED_CONVERSION_FACTOR); - } - /// /// ✅ NUEVO: Detiene completamente la curva /// diff --git a/Simulacion/simTransporte.cs b/Simulacion/simTransporte.cs index 9e4923b..72eb83d 100644 --- a/Simulacion/simTransporte.cs +++ b/Simulacion/simTransporte.cs @@ -159,16 +159,6 @@ namespace CtrEditor.Simulacion OnSpeedChanged?.Invoke(this); } - /// - /// Configura la velocidad del transporte en metros por segundo - /// Valores positivos mueven en la dirección del transporte, negativos en dirección opuesta - /// - /// Velocidad en m/s (típicamente entre -5.0 y 5.0) - public void SetTransportSpeed(float speedMeterPerSecond) - { - SetSpeed(speedMeterPerSecond * simBase.SPEED_CONVERSION_FACTOR); - } - /// /// Detiene completamente el transporte ///