Disabling collision response for some objects

revelation60
Posts: 2
Joined: Sun Nov 14, 2010 11:23 am

Disabling collision response for some objects

Post by revelation60 »

In my game I have a player, items and a map. I want the items to fully interact with the map, so with collision response enabled. However, I want the items to have no collision response with the player, but I do want the collision to show up in the contact point list. I have tried using masks, but that didn't work because I got no contact point. How do I do this?
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Disabling collision response for some objects

Post by Flix »

Have you tried with the CF_NO_CONTACT_RESPONSE flag ?

Code: Select all

body->setCollisionFlags(body->getCollisionFlags() | CF_NO_CONTACT_RESPONSE)
Last edited by Flix on Wed Nov 17, 2010 2:28 pm, edited 1 time in total.
revelation60
Posts: 2
Joined: Sun Nov 14, 2010 11:23 am

Re: Disabling collision response for some objects

Post by revelation60 »

Doesn't that disable response for all objects? I still want my items to have a response with the world geometry, only not with the player. I have solved it now by deriving btCollisionDispatcher and adding a check in the needReponse function.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Disabling collision response for some objects

Post by Flix »

I'm sorry I didn't read your post carefully. Basically it seems you need to use it only for some collisions... and I don't think it's possible as far as I know :?
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Disabling collision response for some objects

Post by Flix »

revelation60 wrote:I have solved it now by deriving btCollisionDispatcher and adding a check in the needReponse function.
Good to know it's possible :wink:
fido
Posts: 14
Joined: Sun Mar 22, 2009 5:57 pm

Re: Disabling collision response for some objects

Post by fido »

revelation60 wrote:Doesn't that disable response for all objects? I still want my items to have a response with the world geometry, only not with the player. I have solved it now by deriving btCollisionDispatcher and adding a check in the needReponse function.
I tried something like that and I 've got stuck with limitation that in btCollisionDispatcher I can filter only whole objects. I needed to filter also certain child shapes in btCompoundShape. I ended up with implementation of 32x32 bit matrix in btOverlappingPairCache and every collision object or child of btCompoundShape can have its own mask. It needed huge changes inside both broad and narrow phase as I needed to pass there these masks. Anyway it works fine and it is configurable in any way.