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* body0 = (btCollisionObject*)b0;
|
||||||
btCollisionObject* body1 = (btCollisionObject*)b1;
|
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;
|
void* mem = 0;
|
||||||
|
|
||||||
@@ -146,7 +148,6 @@ btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* bo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
|
bool btCollisionDispatcher::needsResponse(btCollisionObject* body0,btCollisionObject* body1)
|
||||||
{
|
{
|
||||||
//here you can do filtering
|
//here you can do filtering
|
||||||
|
|||||||
@@ -119,18 +119,8 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btCollisionWorld::updateAabbs()
|
void btCollisionWorld::updateSingleAabb(btCollisionObject* colObj)
|
||||||
{
|
{
|
||||||
BT_PROFILE("updateAabbs");
|
|
||||||
|
|
||||||
btTransform predictedTrans;
|
|
||||||
for ( int i=0;i<m_collisionObjects.size();i++)
|
|
||||||
{
|
|
||||||
btCollisionObject* colObj = m_collisionObjects[i];
|
|
||||||
|
|
||||||
//only update aabb of active objects
|
|
||||||
if (colObj->isActive())
|
|
||||||
{
|
|
||||||
btVector3 minAabb,maxAabb;
|
btVector3 minAabb,maxAabb;
|
||||||
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
|
||||||
//need to increase the aabb for contact thresholds
|
//need to increase the aabb for contact thresholds
|
||||||
@@ -160,9 +150,23 @@ void btCollisionWorld::updateAabbs()
|
|||||||
m_debugDrawer->reportErrorWarning("Thanks.\n");
|
m_debugDrawer->reportErrorWarning("Thanks.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void btCollisionWorld::updateAabbs()
|
||||||
|
{
|
||||||
|
BT_PROFILE("updateAabbs");
|
||||||
|
|
||||||
|
btTransform predictedTrans;
|
||||||
|
for ( int i=0;i<m_collisionObjects.size();i++)
|
||||||
|
{
|
||||||
|
btCollisionObject* colObj = m_collisionObjects[i];
|
||||||
|
|
||||||
|
//only update aabb of active objects
|
||||||
|
if (colObj->isActive())
|
||||||
|
{
|
||||||
|
updateSingleAabb(colObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ public:
|
|||||||
return m_dispatcher1;
|
return m_dispatcher1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void updateAabbs();
|
void updateSingleAabb(btCollisionObject* colObj);
|
||||||
|
|
||||||
|
virtual void updateAabbs();
|
||||||
|
|
||||||
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
|
virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ btPairCachingGhostObject::btPairCachingGhostObject()
|
|||||||
|
|
||||||
btPairCachingGhostObject::~btPairCachingGhostObject()
|
btPairCachingGhostObject::~btPairCachingGhostObject()
|
||||||
{
|
{
|
||||||
|
m_hashPairCache->~btHashedOverlappingPairCache();
|
||||||
btAlignedFree( m_hashPairCache );
|
btAlignedFree( m_hashPairCache );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ subject to the following restrictions:
|
|||||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||||
|
|
||||||
|
|
||||||
|
btScalar gContactThresholdFactor=btScalar(0.02);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Make sure this dummy function never changes so that it
|
Make sure this dummy function never changes so that it
|
||||||
can be used by probes that are checking whether the
|
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
|
btScalar btCollisionShape::getContactBreakingThreshold() const
|
||||||
{
|
{
|
||||||
///@todo make this 0.1 configurable
|
return getAngularMotionDisc() * gContactThresholdFactor;
|
||||||
return getAngularMotionDisc() * btScalar(0.1);
|
|
||||||
}
|
}
|
||||||
btScalar btCollisionShape::getAngularMotionDisc() const
|
btScalar btCollisionShape::getAngularMotionDisc() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -779,14 +779,16 @@ class btClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConve
|
|||||||
btCollisionObject* m_me;
|
btCollisionObject* m_me;
|
||||||
btScalar m_allowedPenetration;
|
btScalar m_allowedPenetration;
|
||||||
btOverlappingPairCache* m_pairCache;
|
btOverlappingPairCache* m_pairCache;
|
||||||
|
btDispatcher* m_dispatcher;
|
||||||
|
|
||||||
|
|
||||||
public:
|
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),
|
btCollisionWorld::ClosestConvexResultCallback(fromA,toA),
|
||||||
m_allowedPenetration(0.0f),
|
m_allowedPenetration(0.0f),
|
||||||
m_me(me),
|
m_me(me),
|
||||||
m_pairCache(pairCache)
|
m_pairCache(pairCache),
|
||||||
|
m_dispatcher(dispatcher)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,6 +823,11 @@ public:
|
|||||||
if (!ClosestConvexResultCallback::needsCollision(proxy0))
|
if (!ClosestConvexResultCallback::needsCollision(proxy0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
///don't do CCD when there are already contact points (touching contact/penetration)
|
///don't do CCD when there are already contact points (touching contact/penetration)
|
||||||
btAlignedObjectArray<btPersistentManifold*> manifoldArray;
|
btAlignedObjectArray<btPersistentManifold*> manifoldArray;
|
||||||
btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0);
|
btBroadphasePair* collisionPair = m_pairCache->findPair(m_me->getBroadphaseHandle(),proxy0);
|
||||||
@@ -838,6 +845,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,7 +880,7 @@ void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep)
|
|||||||
{
|
{
|
||||||
gNumClampedCcdMotions++;
|
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());
|
btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
|
||||||
btSphereShape tmpSphere(body->getCcdSweptSphereRadius());//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