Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Collision filtering problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 ic0de   Members   -  Reputation: 909

Like
0Likes
Like

Posted 23 January 2013 - 09:32 PM

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, 23 January 2013 - 09:35 PM.

you know you program too much when you start ending sentences with semicolons;


Sponsor:

#2 ic0de   Members   -  Reputation: 909

Like
0Likes
Like

Posted 24 January 2013 - 10:05 PM

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.

you know you program too much when you start ending sentences with semicolons;


#3 Krohm   Crossbones+   -  Reputation: 3240

Like
0Likes
Like

Posted 25 January 2013 - 02:18 AM

Ok, let me take a look at the masks...
Kinematic=4
All=-1
Default=1

ghostObj group=0000 0000 0000 0100 against=1111 1111 1111 10111
rigidBody1 group=0000 0000 0000 0100 against=0000 0000 0000 00001

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

Notes.
  • Don't use btCollisionObject and btRigidBody 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 btGhostObject 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, 25 January 2013 - 02:23 AM.


#4 ic0de   Members   -  Reputation: 909

Like
0Likes
Like

Posted 25 January 2013 - 02:29 PM

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?

you know you program too much when you start ending sentences with semicolons;


#5 Krohm   Crossbones+   -  Reputation: 3240

Like
0Likes
Like

Posted 30 January 2013 - 05:38 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS