diff --git a/src/bounce/dynamics/cloth/cloth.cpp b/src/bounce/dynamics/cloth/cloth.cpp index 45c6135..72d4e69 100644 --- a/src/bounce/dynamics/cloth/cloth.cpp +++ b/src/bounce/dynamics/cloth/cloth.cpp @@ -891,6 +891,7 @@ void b3Cloth::Solve(float32 dt, const b3Vec3& gravity) solverDef.forceCapacity = m_forceList.m_count; solverDef.bodyContactCapacity = m_particleList.m_count; solverDef.particleContactCapacity = m_particleContactList.m_count; + solverDef.triangleContactCapacity = m_triangleContactList.m_count; b3ClothSolver solver(solverDef); diff --git a/src/bounce/dynamics/cloth/cloth_solver.cpp b/src/bounce/dynamics/cloth/cloth_solver.cpp index e0f1f25..27c70ea 100644 --- a/src/bounce/dynamics/cloth/cloth_solver.cpp +++ b/src/bounce/dynamics/cloth/cloth_solver.cpp @@ -279,7 +279,7 @@ void b3ClothSolver::Solve(float32 dt, const b3Vec3& gravity) InitializeParticleContactConstraints(); // Initialize triangle contact constraints - // InitializeTriangleContactConstraints(); + InitializeTriangleContactConstraints(); // Warm start velocity constraints WarmStart(); @@ -291,7 +291,7 @@ void b3ClothSolver::Solve(float32 dt, const b3Vec3& gravity) { SolveBodyContactVelocityConstraints(); SolveParticleContactVelocityConstraints(); - // SolveTriangleContactVelocityConstraints(); + SolveTriangleContactVelocityConstraints(); } // Store impulses to improve convergence @@ -307,9 +307,8 @@ void b3ClothSolver::Solve(float32 dt, const b3Vec3& gravity) for (u32 i = 0; i < kPositionIterations; ++i) { bool particleContactsSolved = SolveParticleContactPositionConstraints(); - // bool triangleContactsSolved = SolveTriangleContactPositionConstraints(); - //if (particleContactsSolved && triangleContactsSolved) - if (particleContactsSolved) + bool triangleContactsSolved = SolveTriangleContactPositionConstraints(); + if (particleContactsSolved && triangleContactsSolved) { positionSolved = true; break;