Collision filter seems doesnt work properly

Post Reply
qwase
Posts: 2
Joined: Mon Jul 09, 2012 8:58 pm

Collision filter seems doesnt work properly

Post by qwase »

I have 3 objects (A,B,C). B is static, A,C are dynamic. And i want to create filtering like this:
A collides with B, C
B collides with A
C collides with A

In other words:
B <> A <> C

But C <> B collision also works. I cant to implement this with bullet. Is it possible?
My set up:

Code: Select all

A
"collision_group" : 1
"collision_mask" : 6

B
"collision_group" : 2
"collision_mask" : 1

C
"collision_group" : 4
"collision_mask" : 1
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Collision filter seems doesnt work properly

Post by drleviathan »

Your setup looks correct to me. I've tested collision filtering before and got it to work as expected so I wonder what is wrong with your code.

Perhaps this note on the wiki page is relevant?
Note: Bullet also defines its own collision constants, which are hardcoded as defaults into a few places. So some care is needed to make use of all 15 possible custom types. First, be sure to always specify your groups and masks explicitly when calling various methods such as btDiscreteDynamicsWorld::addRigidBody. A bit less obvious, know that many default callback structures initialize data members. For example, RayResultCallback has a member m_collisionFilterGroup which is initialized to DefaultFilter. There is no constructor argument for it (and perhaps a more intuitive default would be AllFilter), so it can be easy to miss. You can either set the member yourself after construction or derive your own callback types.
qwase
Posts: 2
Joined: Mon Jul 09, 2012 8:58 pm

Re: Collision filter seems doesnt work properly

Post by qwase »

Are you make B as static and A,C as dynamic objects?
btw i'm using 2.83 version.
Post Reply