i'm evaluating several engines for a bigger project. It's about simulating a large amount of little convex trimesh-objects colliding. I do not except real-time.
But bullet is way slower then any other engine. i think i missed something, triggered a debug mode or forgot to initialise some speedups. It compiles into release mode. This is the initialisation:
Code: Select all
int maxProxies = 32766;
btDefaultCollisionConfiguration* m_collisionConfiguration = new btDefaultCollisionConfiguration();
btCollisionDispatcher* m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-50, -50, -50);
btVector3 worldAabbMax(50, 50, 50);
btAxisSweep3* m_overlappingPairCache = new btAxisSweep3(worldAabbMin, worldAabbMax, maxProxies);
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;
world = new btDiscreteDynamicsWorld(m_dispatcher, m_overlappingPairCache, sol, m_collisionConfiguration);
world->setGravity(btVector3(0, -9.81, 0));
Code: Select all
float mass = 1.f;
btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin(btVector3(pos_x, pos_y, pos_z));
btTriangleMesh* mesh = new btTriangleMesh();
float* tri = m_type->getVertex(); //die Dreiecke
int number_of_tris = m_type->getSize(); //Anzahl der Dreiecke
for (int i =0;i<number_of_tris;i++){
mesh->addTriangle(btVector3(tri[i*9], tri[(i*9)+1], tri[(i*9)+2]),
btVector3(tri[(i*9)+3], tri[(i*9)+4], tri[(i*9)+5]),
btVector3(tri[(i*9)+6], tri[(i*9)+7], tri[(i*9)+8]));
}
btCollisionShape* shape = new btConvexTriangleMeshShape(mesh);
btVector3 localInertia(0, 0, 0);
localInertia[0] = m_type->inertia[0][0];
localInertia[1] = m_type->inertia[1][1];
localInertia[2] = m_type->inertia[2][2];
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
m_body = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(mass, myMotionState, shape, localInertia));
Any ideas ?
Thanks