I am trying to use Bullet for collision detection ( I won't use dynamics ) in my game and I was hoping to get some help implementing it correctly. I have taken a look at the collisioninterface demo that comes with the sdk. I also came across the following code snippet to check collision between 2 objects.
Code: Select all
btCollisionAlgorithm* pAlgorithm = pBtWorld->getDispatcher()->findAlgorithm( pBulletObj1, pBulletObj2 );
btManifoldResult oManifoldResult( pBulletObj1, pBulletObj2 );
pAlgorithm->processCollision( pBulletObj1, pBulletObj2, pBtWorld->getDispatchInfo(), &oManifoldResult );
btPersistentManifold* pManifold = oManifoldResult.getPersistentManifold();
I could also use the above code snippet and manually perform collision between different objects in my scene graph. This way I could use the scene graph tree to reject a lot of collision detection queries for child tree member objects when the bounding box of a parent element in the scenegraph tree doesn't collide. Can anyone tell me if this is a good idea, or am I going to kill performance when I do this? If so, are there any other ways to provide the my scenegraph information to Bullet allowing it to reject collision queries based on scenegraph information?
Thanks in advance for your help,
Mathijs