Combining collision flag

Post Reply
floorinthebathroom
Posts: 6
Joined: Sun Nov 11, 2018 7:34 am

Combining collision flag

Post by floorinthebathroom » Thu Jan 31, 2019 10:21 pm

is it possible to combine two collision flags in one object?, for e.g.

Code: Select all

mBody->setCollisionFlags(mBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK | btCollisionObject::CF_KINEMATIC_OBJECT);
but when I do so, it seems only Material Callback take effect, I want to have a kinematic object but also have contact callback capabilities, I know that the easiest way is that you define a material callback on an opposing object, but in this case, I would like to combine it with kinematic object, please help

thank you

User avatar
drleviathan
Posts: 550
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Combining collision flag

Post by drleviathan » Sun Feb 03, 2019 2:37 am

Combining those two flags should work fine, however if you're changing the MotionType from STATIC to KINEMATIC then you need to first remove the body from the World and re-add it. You can't change between those two MotionTypes on the fly because the bodies live on distinct internal lists inside the btDiscreteDynamicsWorld (which I assume you are using). I believe it OK to switch between DYNAMIC and KINEMATIC on the fly.

floorinthebathroom
Posts: 6
Joined: Sun Nov 11, 2018 7:34 am

Re: Combining collision flag

Post by floorinthebathroom » Sun Feb 03, 2019 10:57 pm

Thank you very much drleviathan. this is very helpful

Post Reply