mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-09-30 05:56:00 +00:00
Merge remote-tracking branch 'origin/master' into splitImpulse
This commit is contained in:
@@ -61,7 +61,8 @@ public:
|
||||
virtual void cleanOverlappingPair(btBroadphasePair& pair, btDispatcher* dispatcher) = 0;
|
||||
|
||||
virtual int getNumOverlappingPairs() const = 0;
|
||||
|
||||
virtual bool needsBroadphaseCollision(btBroadphaseProxy * proxy0, btBroadphaseProxy * proxy1) const = 0;
|
||||
virtual btOverlapFilterCallback* getOverlapFilterCallback() = 0;
|
||||
virtual void cleanProxyFromPairs(btBroadphaseProxy* proxy, btDispatcher* dispatcher) = 0;
|
||||
|
||||
virtual void setOverlapFilterCallback(btOverlapFilterCallback* callback) = 0;
|
||||
@@ -380,6 +381,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool needsBroadphaseCollision(btBroadphaseProxy*, btBroadphaseProxy*) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
btOverlapFilterCallback* getOverlapFilterCallback()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
virtual void setOverlapFilterCallback(btOverlapFilterCallback* /*callback*/)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -800,6 +800,14 @@ public:
|
||||
///don't do CCD when the collision filters are not matching
|
||||
if (!ClosestConvexResultCallback::needsCollision(proxy0))
|
||||
return false;
|
||||
if (m_pairCache->getOverlapFilterCallback()) {
|
||||
btBroadphaseProxy* proxy1 = m_me->getBroadphaseHandle();
|
||||
bool collides = m_pairCache->needsBroadphaseCollision(proxy0, proxy1);
|
||||
if (!collides)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
btCollisionObject* otherObj = (btCollisionObject*)proxy0->m_clientObject;
|
||||
|
||||
|
||||
@@ -384,6 +384,9 @@ void btRigidBody::integrateVelocities(btScalar step)
|
||||
{
|
||||
m_angularVelocity *= (MAX_ANGVEL / step) / angvel;
|
||||
}
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_angularVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
btQuaternion btRigidBody::getOrientation() const
|
||||
|
||||
@@ -305,6 +305,9 @@ public:
|
||||
void applyTorque(const btVector3& torque)
|
||||
{
|
||||
m_totalTorque += torque * m_angularFactor;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_totalTorque);
|
||||
#endif
|
||||
}
|
||||
|
||||
void applyForce(const btVector3& force, const btVector3& rel_pos)
|
||||
@@ -316,11 +319,17 @@ public:
|
||||
void applyCentralImpulse(const btVector3& impulse)
|
||||
{
|
||||
m_linearVelocity += impulse * m_linearFactor * m_inverseMass;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_linearVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void applyTorqueImpulse(const btVector3& torque)
|
||||
{
|
||||
m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_angularVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void applyImpulse(const btVector3& impulse, const btVector3& rel_pos)
|
||||
@@ -361,20 +370,46 @@ public:
|
||||
{
|
||||
m_pushVelocity = v;
|
||||
}
|
||||
|
||||
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
void clampVelocity(btVector3& v) const {
|
||||
v.setX(
|
||||
fmax(-BT_CLAMP_VELOCITY_TO,
|
||||
fmin(BT_CLAMP_VELOCITY_TO, v.getX()))
|
||||
);
|
||||
v.setY(
|
||||
fmax(-BT_CLAMP_VELOCITY_TO,
|
||||
fmin(BT_CLAMP_VELOCITY_TO, v.getY()))
|
||||
);
|
||||
v.setZ(
|
||||
fmax(-BT_CLAMP_VELOCITY_TO,
|
||||
fmin(BT_CLAMP_VELOCITY_TO, v.getZ()))
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void setTurnVelocity(const btVector3& v)
|
||||
{
|
||||
m_turnVelocity = v;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_turnVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void applyCentralPushImpulse(const btVector3& impulse)
|
||||
{
|
||||
m_pushVelocity += impulse * m_linearFactor * m_inverseMass;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_pushVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void applyTorqueTurnImpulse(const btVector3& torque)
|
||||
{
|
||||
m_turnVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_turnVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
void clearForces()
|
||||
@@ -408,12 +443,18 @@ public:
|
||||
{
|
||||
m_updateRevision++;
|
||||
m_linearVelocity = lin_vel;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_linearVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void setAngularVelocity(const btVector3& ang_vel)
|
||||
{
|
||||
m_updateRevision++;
|
||||
m_angularVelocity = ang_vel;
|
||||
#if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0
|
||||
clampVelocity(m_angularVelocity);
|
||||
#endif
|
||||
}
|
||||
|
||||
btVector3 getVelocityInLocalPoint(const btVector3& rel_pos) const
|
||||
|
||||
@@ -29,6 +29,10 @@ subject to the following restrictions:
|
||||
static inline btDbvtNode* buildTreeBottomUp(btAlignedObjectArray<btDbvtNode*>& leafNodes, btAlignedObjectArray<btAlignedObjectArray<int> >& adj)
|
||||
{
|
||||
int N = leafNodes.size();
|
||||
if (N == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
while (N > 1)
|
||||
{
|
||||
btAlignedObjectArray<bool> marked;
|
||||
|
||||
Reference in New Issue
Block a user