|
I guess that dispatch all collision pairs is just applying collision response to them or?. Is this usually a bottleneck?, I changed some parameters now for example the maximum simulation steps and also
m_broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,3500,pairCache);
the 3500 to something larger and smaller, but then the time that dispatchallcollisionpairs took would raise to over 100 ms.
Can it be because of a lot collisions between the 2 objects?
I use this code to create the dynamic object
btTransform localTrans; localTrans.setIdentity(); btConvexHullShape* nonStaticShape = new btConvexHullShape(); for (unsigned int i=0; i<numVertices ;i++) { btVector3 vtx(vertex[i].x,vertex[i].y,vertex[i].z); nonStaticShape->addPoint(vtx); } btShapeHull* hull = new btShapeHull(nonStaticShape); btScalar margin = nonStaticShape->getMargin(); hull->buildHull(margin); btConvexHullShape* simplifiednonStaticShape = new btConvexHullShape(&hull->getVertexPointer()->x(),hull->numVertices()); btVector3 localInertia(0,0,0); if(mass) simplifiednonStaticShape->calculateLocalInertia(mass,localInertia); btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform); btRigidBody::btRigidBodyConstructionInfo cInfo(mass,myMotionState,simplifiednonStaticShape,localInertia); btRigidBody* body = new btRigidBody(cInfo); body->setContactProcessingThreshold(0.f); m_dynamicsWorld->addRigidBody(body);
|