Se simplificó el método RemoverBody en simTransporte y simCurve, confiando en BEPU para la limpieza de constraints. Se implementaron nuevos métodos para la creación y actualización de motores, mejorando la gestión de motores dinámicos. Además, se optimizó la verificación de contacto entre botellas y transportes/curvas, y se introdujo un sistema de eliminación diferida para objetos, mejorando la seguridad y eficiencia del código. Se eliminaron métodos obsoletos relacionados con la depuración de triángulos en BEPU.
This commit is contained in:
parent
c1584e8d55
commit
ba073a9e80
1073
Simulacion/BEPU.cs
1073
Simulacion/BEPU.cs
File diff suppressed because it is too large
Load Diff
|
@ -1055,91 +1055,6 @@ namespace CtrEditor.Simulacion
|
|||
return DebugShowIndividualTriangles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ✅ NUEVO: Obtiene información detallada de debug sobre los triángulos reales de BEPU
|
||||
/// Extrae y muestra los triángulos exactos almacenados en la simulación física
|
||||
/// </summary>
|
||||
/// <param name="curve">Curva para analizar</param>
|
||||
/// <returns>Información de debug como string</returns>
|
||||
public string GetCurveDebugInfo(simCurve curve)
|
||||
{
|
||||
if (curve == null)
|
||||
return "ERROR: Curva es null";
|
||||
|
||||
try
|
||||
{
|
||||
var debugInfo = new System.Text.StringBuilder();
|
||||
|
||||
debugInfo.AppendLine($"=== DEBUG INFO TRIÁNGULOS REALES DE BEPU ===");
|
||||
debugInfo.AppendLine($"Parámetros de curva:");
|
||||
debugInfo.AppendLine($" - Radio Interior: {curve.InnerRadius}");
|
||||
debugInfo.AppendLine($" - Radio Exterior: {curve.OuterRadius}");
|
||||
debugInfo.AppendLine($" - Ángulo Inicio: {curve.StartAngle}° ({curve.StartAngle * Math.PI / 180:F3} rad)");
|
||||
debugInfo.AppendLine($" - Ángulo Fin: {curve.EndAngle}° ({curve.EndAngle * Math.PI / 180:F3} rad)");
|
||||
debugInfo.AppendLine($" - Velocidad: {curve.Speed} rad/s");
|
||||
debugInfo.AppendLine($"");
|
||||
|
||||
// ✅ OBTENER INFORMACIÓN REAL DEL MESH DE BEPU
|
||||
var meshInfo = curve.GetBEPUMeshDebugInfo();
|
||||
debugInfo.AppendLine("INFORMACIÓN DEL MESH EN BEPU:");
|
||||
debugInfo.AppendLine(meshInfo);
|
||||
debugInfo.AppendLine($"");
|
||||
|
||||
// ✅ EXTRAER Y MOSTRAR TRIÁNGULOS REALES (LOCALES)
|
||||
var localTriangles = curve.GetRealBEPUTriangles();
|
||||
debugInfo.AppendLine($"TRIÁNGULOS REALES EXTRAÍDOS (LOCALES): {localTriangles.Length}");
|
||||
debugInfo.AppendLine($"");
|
||||
|
||||
// Mostrar los primeros triángulos locales con detalles completos
|
||||
int maxToShow = Math.Min(5, localTriangles.Length);
|
||||
for (int i = 0; i < maxToShow; i++)
|
||||
{
|
||||
var triangle = localTriangles[i];
|
||||
debugInfo.AppendLine($"Triángulo LOCAL {i + 1}:");
|
||||
debugInfo.AppendLine($" A: ({triangle.A.X:F4}, {triangle.A.Y:F4}, {triangle.A.Z:F4})");
|
||||
debugInfo.AppendLine($" B: ({triangle.B.X:F4}, {triangle.B.Y:F4}, {triangle.B.Z:F4})");
|
||||
debugInfo.AppendLine($" C: ({triangle.C.X:F4}, {triangle.C.Y:F4}, {triangle.C.Z:F4})");
|
||||
|
||||
// Calcular área del triángulo
|
||||
var edge1 = triangle.B - triangle.A;
|
||||
var edge2 = triangle.C - triangle.A;
|
||||
var cross = Vector3.Cross(edge1, edge2);
|
||||
var area = cross.Length() / 2f;
|
||||
debugInfo.AppendLine($" Área: {area:F6}");
|
||||
debugInfo.AppendLine($"");
|
||||
}
|
||||
|
||||
// ✅ NUEVO: Mostrar también algunos triángulos en coordenadas mundiales
|
||||
var worldTriangles = curve.GetWorldBEPUTriangles();
|
||||
debugInfo.AppendLine($"TRIÁNGULOS REALES EXTRAÍDOS (MUNDIALES): {worldTriangles.Length}");
|
||||
debugInfo.AppendLine($"");
|
||||
|
||||
for (int i = 0; i < Math.Min(3, worldTriangles.Length); i++)
|
||||
{
|
||||
var triangle = worldTriangles[i];
|
||||
debugInfo.AppendLine($"Triángulo MUNDIAL {i + 1}:");
|
||||
debugInfo.AppendLine($" A: ({triangle.A.X:F4}, {triangle.A.Y:F4}, {triangle.A.Z:F4})");
|
||||
debugInfo.AppendLine($" B: ({triangle.B.X:F4}, {triangle.B.Y:F4}, {triangle.B.Z:F4})");
|
||||
debugInfo.AppendLine($" C: ({triangle.C.X:F4}, {triangle.C.Y:F4}, {triangle.C.Z:F4})");
|
||||
debugInfo.AppendLine($"");
|
||||
}
|
||||
|
||||
if (localTriangles.Length > maxToShow)
|
||||
{
|
||||
debugInfo.AppendLine($"... y {localTriangles.Length - maxToShow} triángulos locales más");
|
||||
}
|
||||
|
||||
debugInfo.AppendLine($"");
|
||||
debugInfo.AppendLine($"Modo debug visual: {(DebugShowIndividualTriangles ? "ACTIVADO (triángulos separados)" : "DESACTIVADO (superficie continua)")}");
|
||||
|
||||
return debugInfo.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"ERROR obteniendo info de debug real: {ex.Message}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ✅ CORREGIDO: Activa la visualización de triángulos locales de BEPU
|
||||
/// Muestra los triángulos exactos extraídos de la simulación física en coordenadas locales
|
||||
|
|
Loading…
Reference in New Issue