Hello,
I'm using bullet physics strictly for collision detection. So far it's working out great.
I have my btCollisionWorld, I add btCollisionObjects with their various btCollisionShapes. Each frame I call btCollisionWorld::updateAabbs and when I need to I query against them using btCollisionWorld::contactTest along with my impl of btCollisionWorld::ContactResultCallback.
I'm now at the point where I need to incorporate collision filtering (http://www.bulletphysics.org/mediawiki- ... _Filtering).
I've created my bit groups and masks and supply them when I call btCollisionWorld::addCollisionObject. However, there doesn't seem to be any way to provide the bit group / masks to btCollisionWorld::contactTest.
Is there a way to utilize collision bit filters when using the btCollisionWorld::contactTest method? If so, how would I go about doing so, and if not, could any suggest the next best approach.
Thanks
Collision Filtering with contactTest
-
- Posts: 849
- Joined: Tue Sep 30, 2014 6:03 pm
- Location: San Francisco
Re: Collision Filtering with contactTest
You want your collision group/masks filtering to be obeyed during the contactTest() call?
If so: I think you would go about it like so:
(1) derive MyCustomContactSensorCallback from btCollisionWorld::ContactResultCallback
(2) override MyCustomContactSensorCallback::needsCollision(btBroadphaseProxy* proxy) to examine proxy.m_collisionFilterGroup and proxy.m_collisionFilterMask and return false when they disagree with the group/mask of your test.
For reference see the wiki page on collision callbacks and triggers.
If so: I think you would go about it like so:
(1) derive MyCustomContactSensorCallback from btCollisionWorld::ContactResultCallback
(2) override MyCustomContactSensorCallback::needsCollision(btBroadphaseProxy* proxy) to examine proxy.m_collisionFilterGroup and proxy.m_collisionFilterMask and return false when they disagree with the group/mask of your test.
For reference see the wiki page on collision callbacks and triggers.