How to disable collision with bodies?

Post Reply
i7.strelok
Posts: 21
Joined: Fri Jan 20, 2017 10:44 pm

How to disable collision with bodies?

Post by i7.strelok » Mon May 08, 2017 1:52 pm

I have 4 rigid bodies, but I want to turn on and off your collision when I want, but I can not.
I'm using the OgreBullet wrapper, but it does not affect using pure code
I thought the line was "setActivationState" but it did not work.

User avatar
Typhontaur
Posts: 125
Joined: Fri Nov 04, 2005 2:22 pm

Re: How to disable collision with bodies?

Post by Typhontaur » Mon May 08, 2017 7:34 pm

Code: Select all

rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
...
and..
rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() & ~btCollisionObject::CF_NO_CONTACT_RESPONSE);
maybe is good, maybe no, try....

i7.strelok
Posts: 21
Joined: Fri Jan 20, 2017 10:44 pm

Re: How to disable collision with bodies?

Post by i7.strelok » Wed May 10, 2017 4:13 pm

One of these lines deactivates or the other active?

User avatar
Typhontaur
Posts: 125
Joined: Fri Nov 04, 2005 2:22 pm

Re: How to disable collision with bodies?

Post by Typhontaur » Thu May 11, 2017 11:49 am

i7.strelok wrote:One of these lines deactivates or the other active?

Code: Select all

DEACTIVATE (OR)---->
rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);

ACTIVATE---(XOR)->
rigidBody->setCollisionFlags(rigidBody->getCollisionFlags() & ~btCollisionObject::CF_NO_CONTACT_RESPONSE);

i7.strelok
Posts: 21
Joined: Fri Jan 20, 2017 10:44 pm

Re: How to disable collision with bodies?

Post by i7.strelok » Tue May 30, 2017 10:01 pm

Muchas gracias! :D :D :D

Post Reply