Page 1 of 1

How to disable collision with bodies?

Posted: Mon May 08, 2017 1:52 pm
by i7.strelok
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.

Re: How to disable collision with bodies?

Posted: Mon May 08, 2017 7:34 pm
by Typhontaur

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....

Re: How to disable collision with bodies?

Posted: Wed May 10, 2017 4:13 pm
by i7.strelok
One of these lines deactivates or the other active?

Re: How to disable collision with bodies?

Posted: Thu May 11, 2017 11:49 am
by Typhontaur
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);

Re: How to disable collision with bodies?

Posted: Tue May 30, 2017 10:01 pm
by i7.strelok
Muchas gracias! :D :D :D