I've discovered a bizarre issue with the Farseer Physics Engine that I can't figure out. I have two Farseer bodies that I'd like to only collide with each other. To that end, I have the following code.
body1.CollisionCategories = Category.Cat1; body1.CollidesWith = Category.Cat2; body2.CollisionCategories = Category.Cat2; body2.CollidesWith = Category.Cat1; Which works fine. However, if I switch the categories around (shown below), the bodies no longer collide.
body1.CollisionCategories = Category.Cat2; body1.CollidesWith = Category.Cat1; body2.CollisionCategories = Category.Cat1; body2.CollidesWith = Category.Cat2; Some additional notes that might be relevant:
- body1 is static, while body2 is dynamic.
- body1 is created before body2 (although I switched the order and nothing changed).
Does anyone know why this happens? Based on my understanding of how Farseer uses collision categories (i.e. as masks using bitwise operations), the order shouldn't matter. Is it something silly I'm missing?
Thank you.