Added btNearCallback. This is similar to Open Dynamics Engine (ODE) dNearCallback, but important differences:
- contact points are persistent (lifetime more then one frame, for warmstarting/incremental contact point management) - continuous collision detection, time of impact Added btRigidBody::isInWorld(), returns true if btRigidBody is inside a btCollisionWorld/btDynamicsWorld derived class Added angularFactor to btRigidbody, this helps some character control (no angular impulse applied)
This commit is contained in:
@@ -70,7 +70,8 @@ struct btBroadphaseProxy
|
||||
StaticFilter = 2,
|
||||
KinematicFilter = 4,
|
||||
DebrisFilter = 8,
|
||||
AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter,
|
||||
SensorTrigger = 16,
|
||||
AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger,
|
||||
};
|
||||
|
||||
//Usually the client btCollisionObject or Rigidbody class
|
||||
@@ -118,8 +119,7 @@ class btCollisionAlgorithm;
|
||||
|
||||
struct btBroadphaseProxy;
|
||||
|
||||
//Increase SIMPLE_MAX_ALGORITHMS to allow multiple btDispatchers caching their own algorithms
|
||||
#define SIMPLE_MAX_ALGORITHMS 1
|
||||
|
||||
|
||||
/// contains a pair of aabb-overlapping objects
|
||||
struct btBroadphasePair
|
||||
@@ -127,22 +127,16 @@ struct btBroadphasePair
|
||||
btBroadphasePair ()
|
||||
:
|
||||
m_pProxy0(0),
|
||||
m_pProxy1(0)
|
||||
m_pProxy1(0),
|
||||
m_algorithm(0)
|
||||
{
|
||||
for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
|
||||
{
|
||||
m_algorithms[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
btBroadphasePair(const btBroadphasePair& other)
|
||||
: m_pProxy0(other.m_pProxy0),
|
||||
m_pProxy1(other.m_pProxy1)
|
||||
m_pProxy1(other.m_pProxy1),
|
||||
m_algorithm(other.m_algorithm)
|
||||
{
|
||||
for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
|
||||
{
|
||||
m_algorithms[i] = other.m_algorithms[i];
|
||||
}
|
||||
}
|
||||
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
@@ -159,17 +153,14 @@ struct btBroadphasePair
|
||||
m_pProxy1 = &proxy0;
|
||||
}
|
||||
|
||||
for (int i=0;i<SIMPLE_MAX_ALGORITHMS;i++)
|
||||
{
|
||||
m_algorithms[i] = 0;
|
||||
}
|
||||
m_algorithm = 0;
|
||||
|
||||
}
|
||||
|
||||
btBroadphaseProxy* m_pProxy0;
|
||||
btBroadphaseProxy* m_pProxy1;
|
||||
|
||||
mutable btCollisionAlgorithm* m_algorithms[SIMPLE_MAX_ALGORITHMS];
|
||||
mutable btCollisionAlgorithm* m_algorithm;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@ class btRigidBody;
|
||||
class btCollisionObject;
|
||||
class btOverlappingPairCache;
|
||||
|
||||
enum btCollisionDispatcherId
|
||||
{
|
||||
RIGIDBODY_DISPATCHER = 0,
|
||||
USERCALLBACK_DISPATCHER
|
||||
};
|
||||
|
||||
class btPersistentManifold;
|
||||
class btStackAlloc;
|
||||
@@ -74,11 +69,6 @@ public:
|
||||
|
||||
virtual btCollisionAlgorithm* findAlgorithm(btCollisionObject* body0,btCollisionObject* body1,btPersistentManifold* sharedManifold=0) = 0;
|
||||
|
||||
//
|
||||
// asume dispatchers to have unique id's in the range [0..max dispacher]
|
||||
//
|
||||
virtual int getUniqueId() = 0;
|
||||
|
||||
virtual btPersistentManifold* getNewManifold(void* body0,void* body1)=0;
|
||||
|
||||
virtual void releaseManifold(btPersistentManifold* manifold)=0;
|
||||
|
||||
@@ -54,14 +54,11 @@ void btOverlappingPairCache::removeOverlappingPair(btBroadphasePair& findPair)
|
||||
|
||||
void btOverlappingPairCache::cleanOverlappingPair(btBroadphasePair& pair)
|
||||
{
|
||||
for (int dispatcherId=0;dispatcherId<SIMPLE_MAX_ALGORITHMS;dispatcherId++)
|
||||
if (pair.m_algorithm)
|
||||
{
|
||||
if (pair.m_algorithms[dispatcherId])
|
||||
{
|
||||
{
|
||||
delete pair.m_algorithms[dispatcherId];
|
||||
pair.m_algorithms[dispatcherId]=0;
|
||||
}
|
||||
delete pair.m_algorithm;;
|
||||
pair.m_algorithm=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user