Page 1 of 1

Combining collision flag

Posted: Thu Jan 31, 2019 10:21 pm
by floorinthebathroom
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

Re: Combining collision flag

Posted: Sun Feb 03, 2019 2:37 am
by drleviathan
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.

Re: Combining collision flag

Posted: Sun Feb 03, 2019 10:57 pm
by floorinthebathroom
Thank you very much drleviathan. this is very helpful