Add to a btRigidBody's collision group/mask

Post Reply
sipickles
Posts: 44
Joined: Thu Aug 07, 2008 6:57 am

Add to a btRigidBody's collision group/mask

Post by sipickles »

Hello,

I have looked through the docs but can't find how to adjust the collision group and/or collision mask after adding a btRigidBody to a btDiscreteDynamicsWorld

Here's how I am doing the original add:

Code: Select all

//Entity collides with other entities, terrain and walls
m_world->addRigidBody( m_body, COLLISION_FILTER_ENTITY, COLLISION_FILTER_ENTITY | COLLISION_FILTER_TERRAIN | COLLISION_FILTER_WALL );
Later I want to make the btRigidBody collide with another group: COLLISION_FILTER_PROXIMITY. Here's what I'd like to be able to do:

Code: Select all

// Add proximity to collision mask
m_body->SetCollisionFilter(  COLLISION_FILTER_ENTITY, COLLISION_FILTER_ENTITY | COLLISION_FILTER_TERRAIN | COLLISION_FILTER_WALL | COLLISION_FILTER_PROXIMITY );
or

Code: Select all

m_world->SetCollisionFilter( m_body, COLLISION_FILTER_ENTITY, COLLISION_FILTER_ENTITY | COLLISION_FILTER_TERRAIN | COLLISION_FILTER_WALL | COLLISION_FILTER_PROXIMITY );
Is my only alternative to remove the rigid body and re-add it with the new settings?

Thanks

Simon
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Add to a btRigidBody's collision group/mask

Post by Erwin Coumans »

Is my only alternative to remove the rigid body and re-add it with the new settings?
Yes, this is the only way. The broadphase pairs need to be updated, and this is exactly what remove/add will do.
Thanks,
Erwin
sipickles
Posts: 44
Joined: Thu Aug 07, 2008 6:57 am

Re: Add to a btRigidBody's collision group/mask

Post by sipickles »

Ok thanks for clarifying.
Post Reply