Hello!

I'm having an issue with collision filtering. I'm using Citrus Engine 2, which uses Box2D for its physics. CE has a custom class that lets you reference bits used in collision filtering by strings, and I've attached that class as a file for reference. (CE is open source, btw.)
I've been reading over the CE manual, Box2D manual, and picking apart tutorials and such, and I think I have this set up properly, but I still have an issue. I have four main objects in my game:
- Obstacles (walls) - assigned to the "Level" collision category
- The player - assigned to "GoodGuys"
- Zombies - assigned to "BadGuys"
- Bullets - assigned to "Bullets"
The Bullets are set to collide with everything but the player, yet they are also not colliding with the Obstacles. I need for that to happen so I can have ricochet effects and such. The Player and zombies have no problems colliding with the walls.
In my initialize() function in my GameState class, when the game first runs, I have this:
Code:
CollisionCategories.Add("Bullets");
Level, GoodGuys, and BadGuys are already added to Citrus Engine by default.
In my Player class, I have this:
Code:
override protected function defineFixture():void
{
super.defineFixture();
_fixtureDef.filter.categoryBits = CollisionCategories.Get("GoodGuys");
_fixtureDef.filter.maskBits = CollisionCategories.GetAllExcept("Bullets");
}//
Zombie class:
Code:
override protected function defineFixture():void
{
super.defineFixture();
_fixtureDef.filter.categoryBits = CollisionCategories.Get("BadGuys");
_fixtureDef.filter.maskBits = CollisionCategories.GetAll();
}//
Obstacle class:
Code:
override protected function defineFixture():void
{
_fixtureDef = new b2FixtureDef();
_fixtureDef.shape = _shape;
_fixtureDef.density = 1;
_fixtureDef.friction = 0;
_fixtureDef.restitution = 1;
_fixtureDef.filter.categoryBits = CollisionCategories.Get("Level");
_fixtureDef.filter.maskBits = CollisionCategories.GetAll();
}//
Bullet class:
Code:
override protected function defineFixture():void
{
super.defineFixture();
_fixtureDef.filter.categoryBits = CollisionCategories.Get("Bullets");
_fixtureDef.filter.maskBits = CollisionCategories.GetAllExcept("GoodGuys");
}//
If I'm understanding all of the forum posts and such that I've read, this is the way to do things. I'm betting that I'm not understanding it properly, so any suggestions on what I'm doing wrong would be greatly appreciated!
EDIT: Never mind, I fixed it. Turns out my filtering is correct, but I was using the PhysicsObject class for my walls in the level instead of the Obstacles class. Oops.