add btCollisionWorld::updateSingleAabb see http://bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=3262
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:
Binary file not shown.
66
msvc/autoexp_dat.txt
Normal file
66
msvc/autoexp_dat.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Microsoft Visual Studio Debug Visualization for Bullet btVector3 and btAlignedObjectArray
|
||||
;
|
||||
; Copy and paste the contents of this file to the end of autoexp.dat, usually located at
|
||||
; C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger\autoexp.dat
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
|
||||
[Visualizer]
|
||||
;------------------------------------------------------------------------------
|
||||
; btVector3
|
||||
;------------------------------------------------------------------------------
|
||||
btVector3{
|
||||
children
|
||||
(
|
||||
#array
|
||||
(
|
||||
expr : ($c.m_floats)[$i],
|
||||
size : 4
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
#array
|
||||
(
|
||||
expr : ($c.m_floats)[$i],
|
||||
size : 4
|
||||
),
|
||||
"]"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; btAlignedObjectArray
|
||||
;------------------------------------------------------------------------------
|
||||
btAlignedObjectArray<*>{
|
||||
children
|
||||
(
|
||||
#array
|
||||
(
|
||||
expr : ($c.m_data)[$i],
|
||||
size : $c.m_size
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
$c.m_size ,
|
||||
"](",
|
||||
|
||||
#array
|
||||
(
|
||||
expr : ($c.m_data)[$i],
|
||||
size : $c.m_size
|
||||
),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -133,8 +133,9 @@ public:
|
||||
return m_dispatcher1;
|
||||
}
|
||||
|
||||
virtual void updateAabbs();
|
||||
void updateSingleAabb(btCollisionObject* colObj);
|
||||
|
||||
virtual void updateAabbs();
|
||||
|
||||
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,7 @@ btPairCachingGhostObject::btPairCachingGhostObject()
|
||||
|
||||
btPairCachingGhostObject::~btPairCachingGhostObject()
|
||||
{
|
||||
m_hashPairCache->~btHashedOverlappingPairCache();
|
||||
btAlignedFree( m_hashPairCache );
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -779,14 +779,16 @@ class btClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConve
|
||||
btCollisionObject* m_me;
|
||||
btScalar m_allowedPenetration;
|
||||
btOverlappingPairCache* m_pairCache;
|
||||
btDispatcher* m_dispatcher;
|
||||
|
||||
|
||||
public:
|
||||
btClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache) :
|
||||
btClosestNotMeConvexResultCallback (btCollisionObject* me,const btVector3& fromA,const btVector3& toA,btOverlappingPairCache* pairCache,btDispatcher* dispatcher) :
|
||||
btCollisionWorld::ClosestConvexResultCallback(fromA,toA),
|
||||
m_allowedPenetration(0.0f),
|
||||
m_me(me),
|
||||
m_pairCache(pairCache)
|
||||
m_pairCache(pairCache),
|
||||
m_dispatcher(dispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -821,20 +823,26 @@ public:
|
||||
if (!ClosestConvexResultCallback::needsCollision(proxy0))
|
||||
return false;
|
||||
|
||||
///don't do CCD when there are already contact points (touching contact/penetration)
|
||||
btAlignedObjectArray<btPersistentManifold*> manifoldArray;
|
||||
btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0);
|
||||
if (collisionPair)
|
||||
btCollisionObject* otherObj = (btCollisionObject*) proxy0->m_clientObject;
|
||||
|
||||
//call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179
|
||||
if (m_dispatcher->needsResponse(m_me,otherObj))
|
||||
{
|
||||
if (collisionPair->m_algorithm)
|
||||
///don't do CCD when there are already contact points (touching contact/penetration)
|
||||
btAlignedObjectArray<btPersistentManifold*> manifoldArray;
|
||||
btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0);
|
||||
if (collisionPair)
|
||||
{
|
||||
manifoldArray.resize(0);
|
||||
collisionPair->m_algorithm->getAllContactManifolds(manifoldArray);
|
||||
for (int j=0;j<manifoldArray.size();j++)
|
||||
if (collisionPair->m_algorithm)
|
||||
{
|
||||
btPersistentManifold* manifold = manifoldArray[j];
|
||||
if (manifold->getNumContacts()>0)
|
||||
return false;
|
||||
manifoldArray.resize(0);
|
||||
collisionPair->m_algorithm->getAllContactManifolds(manifoldArray);
|
||||
for (int j=0;j<manifoldArray.size();j++)
|
||||
{
|
||||
btPersistentManifold* manifold = manifoldArray[j];
|
||||
if (manifold->getNumContacts()>0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,7 +880,7 @@ void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep)
|
||||
{
|
||||
gNumClampedCcdMotions++;
|
||||
|
||||
btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache());
|
||||
btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache(),getDispatcher());
|
||||
btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
|
||||
btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user