Collision groups again, How do I change them?
Posted: Thu Jan 08, 2015 4:39 am
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
Thanks,
Wil McV
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);
Wil McV