Thanks to Mårten Svanfeldt for the contribution:

- optionally disable collisions between bodies that are linked with constraints
- improved debug rendering with support for compounds, spheres, capsules
This commit is contained in:
ejcoumans
2007-06-28 19:14:30 +00:00
parent a0c5401033
commit ced94d63bf
9 changed files with 1204 additions and 1037 deletions

View File

@@ -273,6 +273,8 @@ bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionO
if ((!body0->isActive()) && (!body1->isActive()))
needsCollision = false;
else if (!body0->checkCollideWith(body1))
needsCollision = false;
return needsCollision ;

View File

@@ -24,7 +24,8 @@ btCollisionObject::btCollisionObject()
m_userObjectPointer(0),
m_hitFraction(btScalar(1.)),
m_ccdSweptSphereRadius(btScalar(0.)),
m_ccdSquareMotionThreshold(btScalar(0.))
m_ccdSquareMotionThreshold(btScalar(0.)),
m_checkCollideWith(false)
{
}

View File

@@ -69,15 +69,23 @@ protected:
void* m_internalOwner;
///time of impact calculation
btScalar m_hitFraction;
btScalar m_hitFraction;
///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
btScalar m_ccdSweptSphereRadius;
btScalar m_ccdSweptSphereRadius;
/// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
btScalar m_ccdSquareMotionThreshold;
btScalar m_ccdSquareMotionThreshold;
char m_pad[8];
/// If some object should have elaborate collision filtering by sub-classes
bool m_checkCollideWith;
char m_pad[7];
virtual bool checkCollideWithOverride(btCollisionObject* co)
{
return true;
}
public:
@@ -159,7 +167,7 @@ public:
return ((getActivationState() != ISLAND_SLEEPING) && (getActivationState() != DISABLE_SIMULATION));
}
void setRestitution(btScalar rest)
void setRestitution(btScalar rest)
{
m_restitution = rest;
}
@@ -322,6 +330,15 @@ public:
m_userObjectPointer = userPointer;
}
inline bool checkCollideWith(btCollisionObject* co)
{
if (m_checkCollideWith)
return checkCollideWithOverride(co);
return true;
}
}
;