I am having a problem with collision tests though. Basically I need to check if there is anything in a certain area in space, and get a yes/no answer. I have this code, which does a convex sweep test with a sphere:
Code: Select all
btSphereShape sphere(radius);
btTransform from;
from.setIdentity();
from.setOrigin(position);
btCollisionWorld::ClosestConvexResultCallback cb(from.getOrigin(), from.getOrigin() );
m_dynamicsWorld->convexSweepTest(&sphere, from, from, cb);
return cb.hasHit();
Is there something obvious I am missing in the above code? The only thing different from the Bullet examples is that I am using the same position as the start and end-points of the sweep - is that wrong? If so, is there a better way to do a simple test of collisions with a sphere shape at some location in space?
(edit: typo)