Fix memory leak, see http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=3266
Change contact breaking threshold
Add 'needsResponse' test for CcdMotionClamping, see http://code.google.com/p/bullet/issues/detail?id=179
Updated user manual (needs lots more work)
Added autoexp.dat, enabled Microsoft Visual Studio debug visualization for btAlignedObjectArray and btVector3.
This commit is contained in:
erwin.coumans
2009-02-27 02:33:48 +00:00
parent 0066e41a92
commit 3548c01985
8 changed files with 132 additions and 49 deletions

View File

@@ -79,7 +79,9 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(void* b0,void* b1)
btCollisionObject* body0 = (btCollisionObject*)b0;
btCollisionObject* body1 = (btCollisionObject*)b1;
btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
//test for Bullet 2.74: use a relative contact breaking threshold without clamping against 'gContactBreakingThreshold'
//btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
btScalar contactBreakingThreshold = btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold());
void* mem = 0;
@@ -146,7 +148,6 @@ btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* bo
bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
{
//here you can do filtering

View File

@@ -119,6 +119,39 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
void btCollisionWorld::updateSingleAabb(btCollisionObject* colObj)
{
btVector3 minAabb,maxAabb;
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
//need to increase the aabb for contact thresholds
btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
minAabb -= contactThreshold;
maxAabb += contactThreshold;
btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
//moving objects should be moderately sized, probably something wrong if not
if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
{
bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
} else
{
//something went wrong, investigate
//this assert is unwanted in 3D modelers (danger of loosing work)
colObj->setActivationState(DISABLE_SIMULATION);
static bool reportMe = true;
if (reportMe && m_debugDrawer)
{
reportMe = false;
m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
m_debugDrawer->reportErrorWarning("Thanks.\n");
}
}
}
void btCollisionWorld::updateAabbs()
{
BT_PROFILE("updateAabbs");
@@ -131,38 +164,9 @@ void btCollisionWorld::updateAabbs()
//only update aabb of active objects
if (colObj->isActive())
{
btVector3 minAabb,maxAabb;
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
//need to increase the aabb for contact thresholds
btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
minAabb -= contactThreshold;
maxAabb += contactThreshold;
btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
//moving objects should be moderately sized, probably something wrong if not
if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
{
bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
} else
{
//something went wrong, investigate
//this assert is unwanted in 3D modelers (danger of loosing work)
colObj->setActivationState(DISABLE_SIMULATION);
static bool reportMe = true;
if (reportMe && m_debugDrawer)
{
reportMe = false;
m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
m_debugDrawer->reportErrorWarning("Thanks.\n");
}
}
updateSingleAabb(colObj);
}
}
}

View File

@@ -133,8 +133,9 @@ public:
return m_dispatcher1;
}
virtual void updateAabbs();
void updateSingleAabb(btCollisionObject* colObj);
virtual void updateAabbs();
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
{

View File

@@ -63,6 +63,7 @@ btPairCachingGhostObject::btPairCachingGhostObject()
btPairCachingGhostObject::~btPairCachingGhostObject()
{
m_hashPairCache->~btHashedOverlappingPairCache();
btAlignedFree( m_hashPairCache );
}

View File

@@ -16,6 +16,9 @@ subject to the following restrictions:
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
btScalar gContactThresholdFactor=btScalar(0.02);
/*
Make sure this dummy function never changes so that it
can be used by probes that are checking whether the
@@ -44,8 +47,7 @@ void btCollisionShape::getBoundingSphere(btVector3& center,btScalar& radius) con
btScalar btCollisionShape::getContactBreakingThreshold() const
{
///@todo make this 0.1 configurable
return getAngularMotionDisc() * btScalar(0.1);
return getAngularMotionDisc() * gContactThresholdFactor;
}
btScalar btCollisionShape::getAngularMotionDisc() const
{