i'm making a scene, similar to the one used in BasicDemo. i have a big cube 5x5x5 built out of cubes 1x1x1. when i run the simulation as long as the cubes start to collide with themselves the animation slows down to 2-4 fps.
its definietly the collision-related problem because the more cubes are colliding, the bigger the slowdown is.
what i'm doing is:
physicsInit
Code: Select all
btTransform startTransform;
startTransform.setIdentity();
for (int i = 0; i < wallSize; i++){
for (int j = 0; j < wallSize; j++){
for (int k = 0; k < wallSize; k++){
startTransform.setOrigin(btVector3(10+2*i*cubeSize,40+2*j*cubeSize,10+2*k*cubeSize));
btDefaultMotionState* fallMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo cubeRigidBodyCI(mass,fallMotionState,cubeShape,fallInertia);
cubeRigidBody = new btRigidBody(cubeRigidBodyCI);
//cubeRigidBody->setActivationState(ISLAND_SLEEPING);
rigidBodies.push_back(cubeRigidBody); <<------VECTOR here
dynamicsWorld->addRigidBody(cubeRigidBody);
}
}
}
Code: Select all
glPushMatrix();
btScalar m[16];
btDefaultMotionState* myMotionState = (btDefaultMotionState*)rigidBodies[i]->getMotionState();
myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(m);
btglMultMatrix(m);
glCallList(box);
glPopMatrix();
i'm a buller newbie so i don't know yet what could be the reason.
i've tried to add margins but it only gave a small increase in fps (up to 5-6 in biggest stress).