From 4efc983ca529e09c2e3da6afe968fe07b4cc3022 Mon Sep 17 00:00:00 2001 From: Xuchen Han Date: Wed, 4 Mar 2020 17:22:46 -0800 Subject: [PATCH] bug fixes and parameter tuning --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 1 + src/BulletSoftBody/btSoftBody.cpp | 4 ++-- src/BulletSoftBody/btSoftBodyHelpers.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index d0dcd445b..49e580534 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -8327,6 +8327,7 @@ bool PhysicsServerCommandProcessor::processLoadSoftBodyCommand(const struct Shar if (use_bending_spring) { psb->generateBendingConstraints(2); + psb->generateBendingConstraints(2); } } btSoftBody::Material* pm = psb->appendMaterial(); diff --git a/src/BulletSoftBody/btSoftBody.cpp b/src/BulletSoftBody/btSoftBody.cpp index 1cbebfb82..70765a2d3 100644 --- a/src/BulletSoftBody/btSoftBody.cpp +++ b/src/BulletSoftBody/btSoftBody.cpp @@ -3942,8 +3942,8 @@ void btSoftBody::defaultCollisionHandler(const btCollisionObjectWrapper* pcoWrap docollideFace.psb = this; docollideFace.m_colObj1Wrap = pcoWrap; docollideFace.m_rigidBody = prb1; - docollideFace.dynmargin = 0.05*(basemargin + timemargin); - docollideFace.stamargin = 0.05*basemargin; + docollideFace.dynmargin = 0.5*(basemargin + timemargin); + docollideFace.stamargin = 0.5*basemargin; m_fdbvt.collideTV(m_fdbvt.m_root, volume, docollideFace); } } diff --git a/src/BulletSoftBody/btSoftBodyHelpers.cpp b/src/BulletSoftBody/btSoftBodyHelpers.cpp index 9f64de77d..6e8fccc92 100644 --- a/src/BulletSoftBody/btSoftBodyHelpers.cpp +++ b/src/BulletSoftBody/btSoftBodyHelpers.cpp @@ -1581,7 +1581,7 @@ void btSoftBodyHelpers::extrapolateBarycentricWeights(btSoftBody* psb) const btSoftBody::Face& f = psb->m_faces[j]; btVector3 n = btCross(f.m_n[1]->m_x - f.m_n[0]->m_x, f.m_n[2]->m_x - f.m_n[0]->m_x); btVector3 unit_n = n.normalized(); - dist = p.dot(unit_n); + dist = (p-f.m_n[0]->m_x).dot(unit_n); btVector3 proj_p = p - dist*unit_n; getBarycentricWeights(f.m_n[0]->m_x, f.m_n[1]->m_x, f.m_n[2]->m_x, proj_p, bary); btScalar new_min_bary_weight = bary[0];