currently I am using Bullet physics for collision detection.
I created btCollisionWorld with one btStaticPlaneShape object and one btSphere object as follows,
Code: Select all
collisionConfiguration_ = new btDefaultCollisionConfiguration();
collisionDispatcher_ = new btCollisionDispatcher(collisionConfiguration_);
overlappingPairCache_ = new btDbvtBroadphase();
collisionWorld_ = new btCollisionWorld(collisionDispatcher_, overlappingPairCache_, collisionConfiguration_);
Code: Select all
btCollisionShape* floorCollisionShape = new btStaticPlaneShape(btVector3(0, 0, 1), 0);
btCollisionObject *floorCollisionObject = new btCollisionObject();
floorCollisionObject->setCollisionShape(floorCollisionShape);
Code: Select all
btSphereShape* sphereCollisionShape = new btSphereShape(radius);
btCollisionObject* sphereCollisionObject = new btCollisionObject();
sphereCollisionShape->setMargin(0.0);
sphereCollisionObject->setCollisionShape(sphereCollisionShape);
Code: Select all
collisionWorld_->addCollisionObject(...)
I found the running time of performDiscreteCollisionDetection() is around 0.4 us for no collision situation and 0.8 us for collision situation.
(in CPU: Intel® Core™ i7-7700HQ CPU @ 2.80GHz × 8, GPU: Intel® Kabylake GT2 )
As I compare these with the benchmark result from http://www.bulletphysics.org/mediawiki- ... tFramework, my running time is significantly slow. (a benchmark result for non-moving 8000 box with btDbvt is 0.4 ms. I found running time is of the performDiscreteCollisionDetection(n) is almost O(n), thus my result for 8000 box would be apprx. 3 ms which is 10 times slower)
Is this usual? or Am I missing something here? Any suggestion to accelerate my collision checking would be appreciated.
--------
In summary,
1. btCollisionWorld with btDefaultCollisionConfiguration, btDbvtBroadphase, btCollisionDispatcher
2. two object (one is btSphereShape and another one is btStaticPlaneShape)
3. performDiscreteCollisionDetection()
4. run time of performDiscreteCollisionDetection() is
0.4 usec for no collision, 0.7 usec for collision. (in CPU: Intel® Core™ i7-7700HQ CPU @ 2.80GHz × 8, GPU: Intel® Kabylake GT2 )
Cheers!