prevent narrow phase collision detection between rigid and soft when both are sleeping
This commit is contained in:
@@ -3430,16 +3430,18 @@ void btSoftBody::defaultCollisionHandler(const btCollisionObjectWrapper* pcoWrap
|
||||
{
|
||||
|
||||
btRigidBody* prb1 = (btRigidBody*)btRigidBody::upcast(pcoWrap->getCollisionObject());
|
||||
btTransform wtr = pcoWrap->getWorldTransform();
|
||||
|
||||
const btTransform ctr = pcoWrap->getWorldTransform();
|
||||
const btScalar timemargin = (wtr.getOrigin() - ctr.getOrigin()).length();
|
||||
if (pcoWrap->getCollisionObject()->isActive() || this->isActive())
|
||||
{
|
||||
const btTransform wtr = pcoWrap->getWorldTransform();
|
||||
// const btTransform ctr = pcoWrap->getWorldTransform();
|
||||
// const btScalar timemargin = (wtr.getOrigin() - ctr.getOrigin()).length();
|
||||
const btScalar timemargin = 0;
|
||||
const btScalar basemargin = getCollisionShape()->getMargin();
|
||||
btVector3 mins;
|
||||
btVector3 maxs;
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
volume;
|
||||
pcoWrap->getCollisionShape()->getAabb(pcoWrap->getWorldTransform(),
|
||||
pcoWrap->getCollisionShape()->getAabb(wtr,
|
||||
mins,
|
||||
maxs);
|
||||
volume = btDbvtVolume::FromMM(mins, maxs);
|
||||
@@ -3460,6 +3462,7 @@ void btSoftBody::defaultCollisionHandler(const btCollisionObjectWrapper* pcoWrap
|
||||
docollideFace.stamargin = basemargin;
|
||||
m_fdbvt.collideTV(m_fdbvt.m_root, volume, docollideFace);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1074,6 +1074,7 @@ struct btSoftColliders
|
||||
if (psb->checkDeformableContact(m_colObj1Wrap, n.m_x, m, c.m_cti, /*predict = */ true) || psb->checkDeformableContact(m_colObj1Wrap, n.m_q, m, c.m_cti, /*predict = */ true))
|
||||
{
|
||||
const btScalar ima = n.m_im;
|
||||
// todo: collision between multibody and fixed deformable node will be missed.
|
||||
const btScalar imb = m_rigidBody ? m_rigidBody->getInvMass() : 0.f;
|
||||
const btScalar ms = ima + imb;
|
||||
if (ms > 0)
|
||||
@@ -1169,6 +1170,7 @@ struct btSoftColliders
|
||||
{
|
||||
btScalar ima = n0->m_im + n1->m_im + n2->m_im;
|
||||
const btScalar imb = m_rigidBody ? m_rigidBody->getInvMass() : 0.f;
|
||||
// todo: collision between multibody and fixed deformable face will be missed.
|
||||
const btScalar ms = ima + imb;
|
||||
if (ms > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user