Trouble understanding collision groups

Ripiz
Posts: 47
Joined: Mon Aug 16, 2010 10:43 am

Trouble understanding collision groups

Post by Ripiz »

Hello,

I'm trying to figure how to set up collision groups so that the object wouldn't collide with itself. I tried following code:

Code: Select all

mCollisionWorld->addCollisionObject(mGhostObject, btBroadphaseProxy::CharacterFilter, -1 ^ btBroadphaseProxy::CharacterFilter);
I thought second parameter is object's collision group, and third parameter is what this object can collide with. Therefore I set second parameter to CharacterFilter, and third is everything but CharacterFilter, however CollisionWorld->convexSweepTest() still causes my object to collide with itself (I used default btCollisionWorld::ClosestConvexResultCallback callback).

Maybe anyone could explain to me how collision groups work? Thank you in advance.
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: Trouble understanding collision groups

Post by xexuxjy »

I believe you'll have to specifically set the :

short int m_collisionFilterGroup;
short int m_collisionFilterMask;

values on your callback as by default they're set to :

m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
m_collisionFilterMask(btBroadphaseProxy::AllFilter)
Ripiz
Posts: 47
Joined: Mon Aug 16, 2010 10:43 am

Re: Trouble understanding collision groups

Post by Ripiz »

That seems to work, thank you.