Calculation of bounding box: margins should be added before basis transform.

Disable btSphereBoxCollisionAlgorithm, it is broken.
More fixes for btSimpleBroadphase
Moved quickstep to Extras/quickstep folder, so developers don't get confused which constraint solver is default.
This commit is contained in:
erwin.coumans
2008-09-04 22:53:24 +00:00
parent 5334611f48
commit d8a5bf2c9c
29 changed files with 54 additions and 51 deletions

View File

@@ -92,6 +92,7 @@ void BasicDemo::initPhysics()
///Don't make the world AABB size too large, it will harm simulation quality and performance
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
//m_overlappingPairCache = new btSimpleBroadphase();//new btAxisSweep3(worldAabbMin,worldAabbMax,MAX_PROXIES);
m_overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,MAX_PROXIES);
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
@@ -104,8 +105,8 @@ void BasicDemo::initPhysics()
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
///create a few basic rigid bodies
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
// btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
// btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(50.),btScalar(50.)));
btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),50);
m_collisionShapes.push_back(groundShape);
@@ -161,13 +162,15 @@ void BasicDemo::initPhysics()
for (int k=0;k<ARRAY_SIZE_Y;k++)
{
for (int i=0;i<ARRAY_SIZE_X;i++)
int i=0;
// for (int i=0;i<ARRAY_SIZE_X;i++)
{
for(int j = 0;j<ARRAY_SIZE_Z;j++)
int j=0;
// for(int j = 0;j<ARRAY_SIZE_Z;j++)
{
startTransform.setOrigin(btVector3(
2.0*i + start_x,
2.0*k + start_y,
10+2.0*k + start_y,
2.0*j + start_z));
@@ -175,8 +178,10 @@ void BasicDemo::initPhysics()
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);
btRigidBody* body = new btRigidBody(rbInfo);
body->setActivationState(ISLAND_SLEEPING);
m_dynamicsWorld->addRigidBody(body);
body->setActivationState(ISLAND_SLEEPING);
}
}
}

View File

@@ -272,8 +272,9 @@ void BenchmarkDemo::initPhysics()
///Don't make the world AABB size too large, it will harm simulation quality and performance
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
m_overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,3500);
//m_overlappingPairCache = new btDbvtBroadphase();
//m_overlappingPairCache = new btAxisSweep3(worldAabbMin,worldAabbMax,3500);
m_overlappingPairCache = new btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;

View File

@@ -186,7 +186,7 @@ void ConcaveDemo::initPhysics()
bool useQuantizedAabbCompression = true;
//comment out the next line to read the BVH from disk (first run the demo once to create the BVH)
#define SERIALIZE_TO_DISK 1
//#define SERIALIZE_TO_DISK 1
#ifdef SERIALIZE_TO_DISK
btVector3 aabbMin(-1000,-1000,-1000),aabbMax(1000,1000,1000);

View File

@@ -1229,7 +1229,8 @@ void DemoApplication::clientResetScene()
myMotionState->m_graphicsWorldTrans = myMotionState->m_startWorldTrans;
colObj->setWorldTransform( myMotionState->m_graphicsWorldTrans );
colObj->setInterpolationWorldTransform( myMotionState->m_startWorldTrans );
colObj->activate();
//colObj->activate();
colObj->setActivationState(WANTS_DEACTIVATION);
}
//removed cached contact points
m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(colObj->getBroadphaseHandle(),getDynamicsWorld()->getDispatcher());

View File

@@ -85,15 +85,15 @@ public:
normal.normalize();
glBegin(GL_TRIANGLES);
glColor3f(0, 1, 0);
glColor3f(1, 1, 1);
glNormal3d(normal.getX(),normal.getY(),normal.getZ());
glVertex3d(triangle[0].getX(), triangle[0].getY(), triangle[0].getZ());
glColor3f(0, 1, 0);
//glColor3f(0, 1, 0);
glNormal3d(normal.getX(),normal.getY(),normal.getZ());
glVertex3d(triangle[1].getX(), triangle[1].getY(), triangle[1].getZ());
glColor3f(0, 1, 0);
//glColor3f(0, 1, 0);
glNormal3d(normal.getX(),normal.getY(),normal.getZ());
glVertex3d(triangle[2].getX(), triangle[2].getY(), triangle[2].getZ());
glEnd();
@@ -237,11 +237,11 @@ public:
} else
{
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0);
glColor3f(1, 1, 1);
glVertex3d(triangle[0].getX(), triangle[0].getY(), triangle[0].getZ());
glColor3f(0, 1, 0);
//glColor3f(0, 1, 0);
glVertex3d(triangle[1].getX(), triangle[1].getY(), triangle[1].getZ());
glColor3f(0, 0, 1);
//glColor3f(0, 0, 1);
glVertex3d(triangle[2].getX(), triangle[2].getY(), triangle[2].getZ());
glEnd();
}