From baa9dcdf08abb5bc9434a7ab5c480ede4e31994e Mon Sep 17 00:00:00 2001 From: Xuchen Han Date: Thu, 7 Nov 2019 12:13:51 -0800 Subject: [PATCH 1/2] move erp for deformable into a separate parameter --- examples/DeformableDemo/SplitImpulse.cpp | 4 ++-- src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h | 2 ++ src/BulletSoftBody/btDeformableContactProjection.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/DeformableDemo/SplitImpulse.cpp b/examples/DeformableDemo/SplitImpulse.cpp index 6b99e9523..c24a47c42 100644 --- a/examples/DeformableDemo/SplitImpulse.cpp +++ b/examples/DeformableDemo/SplitImpulse.cpp @@ -162,9 +162,9 @@ void SplitImpulse::initPhysics() } #ifdef USE_SPLIT_IMPULSE - getDeformableDynamicsWorld()->getSolverInfo().m_erp = 0.03; + getDeformableDynamicsWorld()->getSolverInfo().m_deformable_erp = 0.03; #else - getDeformableDynamicsWorld()->getSolverInfo().m_erp = 0.0; + getDeformableDynamicsWorld()->getSolverInfo().m_deformable_erp = 0.0; #endif // create a piece of cloth diff --git a/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h b/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h index edb80036d..e82d1b139 100644 --- a/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h +++ b/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h @@ -46,6 +46,7 @@ struct btContactSolverInfoData btScalar m_sor; //successive over-relaxation term btScalar m_erp; //error reduction for non-contact constraints btScalar m_erp2; //error reduction for contact constraints + btScalar m_deformable_erp; //error reduction for deformable constraints btScalar m_globalCfm; //constraint force mixing for contacts and non-contacts btScalar m_frictionERP; //error reduction for friction constraints btScalar m_frictionCFM; //constraint force mixing for friction constraints @@ -81,6 +82,7 @@ struct btContactSolverInfo : public btContactSolverInfoData m_numIterations = 10; m_erp = btScalar(0.2); m_erp2 = btScalar(0.2); + m_deformable_erp = btScalar(0.); m_globalCfm = btScalar(0.); m_frictionERP = btScalar(0.2); //positional friction 'anchors' are disabled by default m_frictionCFM = btScalar(0.); diff --git a/src/BulletSoftBody/btDeformableContactProjection.cpp b/src/BulletSoftBody/btDeformableContactProjection.cpp index dc00e7520..5986e2881 100644 --- a/src/BulletSoftBody/btDeformableContactProjection.cpp +++ b/src/BulletSoftBody/btDeformableContactProjection.cpp @@ -59,7 +59,7 @@ void btDeformableContactProjection::splitImpulseSetup(const btContactSolverInfo& btAlignedObjectArray& constraints = *m_nodeRigidConstraints.getAtIndex(index); for (int i = 0; i < constraints.size(); ++i) { - constraints[i].setPenetrationScale(infoGlobal.m_erp); + constraints[i].setPenetrationScale(infoGlobal.m_deformable_erp); } } @@ -67,7 +67,7 @@ void btDeformableContactProjection::splitImpulseSetup(const btContactSolverInfo& for (int index = 0; index < m_allFaceConstraints.size(); ++index) { btDeformableContactConstraint* constraint = m_allFaceConstraints[index]; - constraint->setPenetrationScale(infoGlobal.m_erp); + constraint->setPenetrationScale(infoGlobal.m_deformable_erp); } } From 059e23d38158af54dba5226eb47ecd4acaddccc5 Mon Sep 17 00:00:00 2001 From: Xuchen Han Date: Thu, 7 Nov 2019 13:00:13 -0800 Subject: [PATCH 2/2] fix old soft body collision issue #2473 --- src/BulletSoftBody/btSoftBody.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/BulletSoftBody/btSoftBody.cpp b/src/BulletSoftBody/btSoftBody.cpp index e4e8c0c41..6c410733b 100644 --- a/src/BulletSoftBody/btSoftBody.cpp +++ b/src/BulletSoftBody/btSoftBody.cpp @@ -92,7 +92,6 @@ void btSoftBody::initDefaults() m_cfg.drag = 0; m_cfg.m_maxStress = 0; m_cfg.collisions = fCollision::Default; - m_cfg.collisions |= fCollision::VF_DD; m_pose.m_bvolume = false; m_pose.m_bframe = false; m_pose.m_volume = 0;