Collision masks
Posted: Thu Apr 29, 2010 12:21 am
Hello,
I have ships and bullets. Ships collide with bullets and with each other. I do not want bullets to collide with other bullets. So I have three collision masks:
I create my ships and bullets with the following flags.
Unfortunately, I register no collisions between bullets and ships. If I create bullets with a SHIP_COLLISION flag, then it works:
From wiki I thought that I can should use NO_COLLISION. Am I missing something here?
Thanks.
I have ships and bullets. Ships collide with bullets and with each other. I do not want bullets to collide with other bullets. So I have three collision masks:
Code: Select all
enum ECollisionTypes
{
NO_COLLISION = 0,
SHIP_COLLISION = 1 << 1,
BULLET_COLLISION = 1 << 2,
};
Code: Select all
// Create bullet, does not produce any collision?
collisionWorld->addCollisionObject(pBullet, BULLET_COLLISION, NO_COLLISION);
// Create ship.
collisionWorld->addCollisionObject(pShip, SHIP_COLLISION, SHIP_COLLISION | BULLET_COLLISION);
Code: Select all
// Create bullet, creates collisions.
collisionWorld->addCollisionObject(pBullet, BULLET_COLLISION, SHIP_COLLISION);
Thanks.