Collision groups again, How do I change them?

Post Reply
Wil McV
Posts: 18
Joined: Tue Aug 26, 2014 5:46 am

Collision groups again, How do I change them?

Post by Wil McV »

So I have another question about collision masks and groups. Say I create an object and add it to the world with a given mask and group, how do I then change those?

Is it possible to do without removing it and re-adding it back into the world? I read somewhere that this was the safest way to do it but it seems a little expensive. Also is it safe to remove an object from the world then add it back in within the same frame?

for instance with the following code

Code: Select all

world->removeCollisionObject(object);
object->mask = NEW_COLLISION_MASK;
world->addCollisionObject(object, object->mask, object->group);
Thanks,
Wil McV
Post Reply