updated test1.oec with a few static objects

fix Maya plugin hinge constraint support
update copyright year in BulletCollision/CollisionShapes.
This commit is contained in:
erwin.coumans
2009-05-12 22:28:45 +00:00
parent 6ac6b3a257
commit 22fe8935c3
73 changed files with 267 additions and 210 deletions

View File

@@ -190,7 +190,7 @@ void BasicDemo::clientMoveAndDisplay()
if (m_dynamicsWorld)
{
#if USE_CUDA_DEMO_PAIR_CASHE
btCudaDemoPairCache* pc = (btCudaDemoPairCache*)m_dynamicsWorld->getPairCache();
btGpuDemoPairCache* pc = (btGpuDemoPairCache*)m_dynamicsWorld->getPairCache();
pc->m_numSmallProxies = m_dynamicsWorld->getNumCollisionObjects(); // - 1; // exclude floor
#endif
m_dynamicsWorld->stepSimulation(gTimeStep,0);//ms / 1000000.f);
@@ -237,7 +237,7 @@ void BasicDemo::displayCallback(void) {
btVector3 gWorldMax( POS_OFFS_X, POS_OFFS_Y, POS_OFFS_Z);
#endif
//btCudaDemoPairCache* gPairCache;
//btGpuDemoPairCache* gPairCache;
btOverlappingPairCache* gPairCache;
@@ -276,7 +276,7 @@ void BasicDemo::initPhysics()
#if USE_CUDA_DEMO_PAIR_CASHE
gPairCache = new (btAlignedAlloc(sizeof(btCudaDemoPairCache),16)) btCudaDemoPairCache(MAX_PROXIES, 24, MAX_SMALL_PROXIES);
gPairCache = new (btAlignedAlloc(sizeof(btGpuDemoPairCache),16)) btGpuDemoPairCache(MAX_PROXIES, 24, MAX_SMALL_PROXIES);
#else
gPairCache = new (btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16))btHashedOverlappingPairCache();
#endif
@@ -319,6 +319,7 @@ void BasicDemo::initPhysics()
//btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,0.1));//SCALING*1));
// btCollisionShape* colShape = new btBox2dShape(btVector3(SCALING*.7,SCALING*.7,0.1));//SCALING*1));
#if 0
#define SPRADIUS btScalar(SCALING*0.1f)
#define SPRPOS btScalar(SCALING*0.05f)
static btVector3 sSphPos[8];
@@ -343,12 +344,13 @@ void BasicDemo::initPhysics()
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
m_collisionShapes.push_back(colShape[0]);
m_collisionShapes.push_back(colShape[1]);
#endif
/// Create Dynamic Objects
btTransform startTransform;
startTransform.setIdentity();
btScalar mass(1.f);
btScalar mass(0.f);
//rigidbody is dynamic if and only if mass is non zero, otherwise static
bool isDynamic = (mass != 0.f);
@@ -614,7 +616,7 @@ void BasicDemo::keyboardCallback(unsigned char key, int x, int y)
if(key == ' ')
{
#if USE_CUDA_DEMO_PAIR_CASHE
((btCudaDemoPairCache*)gPairCache)->reset();
((btGpuDemoPairCache*)gPairCache)->reset();
#endif
}
}

View File

@@ -119,10 +119,14 @@ void BasicOECakeReader::addNewCollisionShape(int numParticles, btVector3* partic
if ((materialType & 0x20000) ||(materialType & 0x12))
{
mass = 1.f;
} else
{
mass = 0.f;
}
btTransform startTransform;
startTransform.setIdentity();
int numCurSpheres = 0;
{
@@ -132,11 +136,19 @@ void BasicOECakeReader::addNewCollisionShape(int numParticles, btVector3* partic
//static
btCompoundShape* compound = new btCompoundShape();
for (int i=0;i<numParticles;i++)
{
numCurSpheres++;
localTrans.setOrigin(particlePositions[i]);
btSphereShape* particle = new btSphereShape(radii[i]);
compound->addChildShape(localTrans,particle);
if (mass==0.f && (numCurSpheres>=7))
{
createBodyForCompoundShape(compound,false,startTransform,mass);
compound = new btCompoundShape();
numCurSpheres = 0;
}
}
if (mass)
{
@@ -152,7 +164,7 @@ void BasicOECakeReader::addNewCollisionShape(int numParticles, btVector3* partic
btDefaultMotionState* myMotionState = 0;
if (colShape)
if (colShape && numCurSpheres)
{
createBodyForCompoundShape(colShape,addConstraint,startTransform,mass);
}