Followers 0

# Collision filtering problem

## 4 posts in this topic

In my game using bullet physics I have a btGhostObject, a bunch of btRigidBodys and a static btCollisionObject. The btCollisionObject should collide with the btRigidBodys all the time and the btGhostObject should collide with every object except for one of the btRigidBodys. Right now I have my code set up like this:

//add the ghostobject which should collide with everything except rigbody1
//add the btRigidBody which should collide with other btRigidBodys
//add the btRigidBody which should collide with everything
//add the btCollisionObject which should collide with everything

As far as I know this should work but it doesn't, ghostObj is still detecting collisions with rigbody1. As far as I know I'm using the mask system properly, perhaps I'm not using bitwise operations correctly? Edited by ic0de
0

##### Share on other sites
Anyone?

anyways I figured out something that I think might be wrong with bullet and was wondering if I was wrong:

when I change the mask for ghostObj to btBroadphaseProxy::DefaultFilter|btBroadphaseProxy::StaticFilter it still doesn't work and seems to be detecting collision with something that doesn't exist because collObj is he only thing marked as static and they surely aren't touching.
0

##### Share on other sites
Ok, let me take a look at the masks...
Kinematic=4
All=-1
Default=1

[font='courier new', courier, monospace]ghostObj group=0000 0000 0000 0100 against=1111 1111 1111 10111[/font]
[font='courier new', courier, monospace]rigidBody1 group=0000 0000 0000 0100 against=0000 0000 0000 00001[/font]

(edit: whoops I messed up the bits)
They should not be colliding. Take a look at manifold pointers

Notes.
• Don't use [font='courier new', courier, monospace]btCollisionObject [/font]and [font='courier new', courier, monospace]btRigidBody[/font] in the same simulation. It's not forbidden but I don't think it's good practice. Use static rigidbodies instead.
• When needing to filter against a specific object, I suggest to NOT use a specific collision group. It would make everything run short of bits quite fast. Either extend [font='courier new', courier, monospace]btGhostObject [/font]to ignore a specific collision object, or just let it work the same way and ignore its manifolds.

when I change the mask for ghostObj to btBroadphaseProxy::DefaultFilter|btBroadphaseProxy::StaticFilter it still doesn't work and seems to be detecting collision with something that doesn't exist because collObj is he only thing marked as static and they surely aren't touching

Not sure what you mean there. A collision manifold will get reported as long as their AABBs overlap in broadphase tests. Edited by Krohm
0

##### Share on other sites

Not sure what you mean there. A collision manifold will get reported as long as their AABBs overlap in broadphase tests.

Oh I see. In that case I must be detecting collisions wrong. I had assumed that ghostObj->getNumOverlappingObjects() would return the number of objects that the ghost object was actually colliding with, I had no idea that it only took into account the AABB. Does anyone know how to actually check if there is an actual collision using a ghost object?
0

##### Share on other sites

Problem is they shouldn't be reported anyway I think. They're in different groups. Have you checked manifold pointers?

0

## Create an account

Register a new account