added some debugging variable for CCD motion clamping
This commit is contained in:
@@ -39,8 +39,11 @@ btTransform startTransforms[maxNumObjects];
|
||||
btCollisionShape* gShapePtr[maxNumObjects];//1 rigidbody has 1 shape (no re-use of shapes)
|
||||
#define SHOW_NUM_DEEP_PENETRATIONS 1
|
||||
|
||||
extern int gNumClampedCcdMotions;
|
||||
|
||||
#ifdef SHOW_NUM_DEEP_PENETRATIONS
|
||||
extern int gNumDeepPenetrationChecks;
|
||||
|
||||
extern int gNumSplitImpulseRecoveries;
|
||||
extern int gNumGjkChecks;
|
||||
extern int gNumAlignedAllocs;
|
||||
@@ -541,6 +544,9 @@ void DemoApplication::shootBox(const btVector3& destination)
|
||||
body->getWorldTransform().setRotation(btQuaternion(0,0,0,1));
|
||||
body->setLinearVelocity(linVel);
|
||||
body->setAngularVelocity(btVector3(0,0,0));
|
||||
body->setCcdSquareMotionThreshold(3600);//1600);//40ms/sec for 60 hertz gives 0.66 m/frame. 40*40=1600
|
||||
body->setCcdSweptSphereRadius(0.2f);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1155,6 +1161,11 @@ void DemoApplication::renderme()
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
|
||||
yStart += yIncr;
|
||||
|
||||
glRasterPos3f(xOffset,yStart,0);
|
||||
sprintf(buf,"gNumClampedCcdMotions = %d",gNumClampedCcdMotions);
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
|
||||
yStart += yIncr;
|
||||
|
||||
glRasterPos3f(xOffset,yStart,0);
|
||||
sprintf(buf,"gNumSplitImpulseRecoveries= %d",gNumSplitImpulseRecoveries);
|
||||
BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);
|
||||
@@ -1218,6 +1229,7 @@ void DemoApplication::clientResetScene()
|
||||
gNumGjkChecks = 0;
|
||||
#endif //SHOW_NUM_DEEP_PENETRATIONS
|
||||
|
||||
gNumClampedCcdMotions = 0;
|
||||
int numObjects = 0;
|
||||
if (m_dynamicsWorld)
|
||||
{
|
||||
|
||||
@@ -707,6 +707,7 @@ void btDiscreteDynamicsWorld::calculateSimulationIslands()
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
|
||||
|
||||
class btClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
|
||||
@@ -775,6 +776,9 @@ public:
|
||||
|
||||
};
|
||||
|
||||
///internal debugging variable. this value shouldn't be too high
|
||||
int gNumClampedCcdMotions=0;
|
||||
|
||||
//#include "stdio.h"
|
||||
void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep)
|
||||
{
|
||||
@@ -796,6 +800,7 @@ void btDiscreteDynamicsWorld::integrateTransforms(btScalar timeStep)
|
||||
BT_PROFILE("CCD motion clamping");
|
||||
if (body->getCollisionShape()->isConvex())
|
||||
{
|
||||
gNumClampedCcdMotions++;
|
||||
body->predictIntegratedTransform(timeStep, predictedTrans);
|
||||
btClosestNotMeConvexResultCallback sweepResults(body,body->getWorldTransform().getOrigin(),predictedTrans.getOrigin(),getBroadphase()->getOverlappingPairCache());
|
||||
btConvexShape* convexShape = static_cast<btConvexShape*>(body->getCollisionShape());
|
||||
|
||||
Reference in New Issue
Block a user