Add btBroadphaseInterface::aabbTest. btDbvtBroadphase and btAxisSweep3 should perform well, as long as the raycast accelerator is enabled.

This should fix the btCollisionWorld::contactTest(btCollisionObject* colObj, ContactResultCallback& resultCallback);

Thanks to Ola for the report!
This commit is contained in:
erwin.coumans
2010-02-11 18:25:50 +00:00
parent 7a175fb65e
commit bb8d1b11df
8 changed files with 115 additions and 7 deletions

View File

@@ -26,7 +26,14 @@ class btOverlappingPairCache;
struct btBroadphaseRayCallback
struct btBroadphaseAabbCallback
{
virtual ~btBroadphaseAabbCallback() {}
virtual bool process(const btBroadphaseProxy* proxy) = 0;
};
struct btBroadphaseRayCallback : public btBroadphaseAabbCallback
{
///added some cached data to accelerate ray-AABB tests
btVector3 m_rayDirectionInverse;
@@ -34,7 +41,6 @@ struct btBroadphaseRayCallback
btScalar m_lambda_max;
virtual ~btBroadphaseRayCallback() {}
virtual bool process(const btBroadphaseProxy* proxy) = 0;
};
#include "LinearMath/btVector3.h"
@@ -54,6 +60,8 @@ public:
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)) = 0;
virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback) = 0;
///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb
virtual void calculateOverlappingPairs(btDispatcher* dispatcher)=0;