Jump to content
  • Advertisement
Sign in to follow this  
ic0de

Collision filtering problem

This topic is 1971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
dynamicsWorld->addCollisionObject(ghostObj, btBroadphaseProxy::KinematicFilter, btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::KinematicFilter);
//add the btRigidBody which should collide with other btRigidBodys
dynamicsWorld->addRigidBody(rigbody1, btBroadphaseProxy::KinematicFilter, btBroadphaseProxy::DefaultFilter);
//add the btRigidBody which should collide with everything
dynamicsWorld->addRigidBody(rigbody);
//add the btCollisionObject which should collide with everything
dynamicsWorld->addRigidBody(collObj);
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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!