diff options
author | Xuchen Han <xuchenhan@xuchenhan-macbookpro.roam.corp.google.com> | 2019-07-12 13:26:58 -0700 |
---|---|---|
committer | Xuchen Han <xuchenhan@xuchenhan-macbookpro.roam.corp.google.com> | 2019-08-02 13:12:42 -0700 |
commit | ac628f4d394f39d10cd178e005b63ad7dda0e1f0 (patch) | |
tree | 7c387171a5b399f7c406bbc1337f104e90dbebfe | |
parent | 98cd9a85e4416686e099969332691c91b60a3468 (diff) | |
download | bullet3-ac628f4d394f39d10cd178e005b63ad7dda0e1f0.tar.gz |
add two way coupled penetration resolution; not momentum conserving, but seem to work fine
-rw-r--r-- | src/BulletSoftBody/btDeformableBodySolver.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/BulletSoftBody/btDeformableBodySolver.cpp b/src/BulletSoftBody/btDeformableBodySolver.cpp index b7c531385..41a5df70d 100644 --- a/src/BulletSoftBody/btDeformableBodySolver.cpp +++ b/src/BulletSoftBody/btDeformableBodySolver.cpp @@ -87,21 +87,22 @@ void btDeformableBodySolver::postStabilize() if (dp < 0) { c.m_node->m_x -= dp * cti.m_normal * c.m_c4; +// c.m_node->m_x -= impulse * c.m_c2; //// -// if (cti.m_colObj->getInternalType() == btCollisionObject::CO_RIGID_BODY) -// { -// if (rigidCol) -// rigidCol->applyImpulse(impulse, c.m_c1); -// } -// else if (cti.m_colObj->getInternalType() == btCollisionObject::CO_FEATHERSTONE_LINK) -// { -// if (multibodyLinkCol) -// { -// double multiplier = 0.5; -// multibodyLinkCol->m_multiBody->applyDeltaVeeMultiDof(deltaV, -impulse.length() * multiplier); -// } -// } + if (cti.m_colObj->getInternalType() == btCollisionObject::CO_RIGID_BODY) + { + if (rigidCol) + rigidCol->applyImpulse(impulse, c.m_c1); + } + else if (cti.m_colObj->getInternalType() == btCollisionObject::CO_FEATHERSTONE_LINK) + { + if (multibodyLinkCol) + { + double multiplier = 0.5; + multibodyLinkCol->m_multiBody->applyDeltaVeeMultiDof(deltaV, -impulse.length() * multiplier); + } + } } } } |