I am using Bullet to carry out about approximately 650 ray collision tests against many (up to 20 or so) meshes, each of which has perhaps 500 faces, as fast as possible (and repeatedly). The collision data needs to be reasonably accurate.
I've noticed that when I have only a single mesh in the scene, the collision testing is very fast, but when more meshes are added to the scene, performance drops. This is, of course, expected, but I was hoping that using filter masks and groups would solve the problem, as I could weed out collisions against meshes that aren't in the field of view. The masks and groups correctly stop collisions from occurring, but don't seem to help performance. Only removing objects from the collision world seems to have any effect on performance. Does this seem correct?
Also, I was hoping someone could give me some tips as to how to make my use of the engine more efficient. I currently do something like this:
Initialization:
Code: Select all
m_pCollisionConfiguration = new btDefaultCollisionConfiguration();
m_pDispatcher = new btCollisionDispatcher(m_pCollisionConfiguration);
m_pBroadphase = new btDbvtBroadphase();
Code: Select all
m_pCollisionWorld->addCollisionObject(itModelIterator->second->m_pModelInUse->GetCollisionObject());
Code: Select all
btCollisionWorld::ClosestRayResultCallback hCallback(hStartPt, hEndPt);
m_pCollisionWorld->rayTest(hStartPt, hEndPt, hCallback);