1
votes

I'm trying to set up collision groups in Farseer so that the items in the picture collide as follows:

  • G1 Collides with All.
  • B1 and B2 collide with each other and G1, but not R1 or R2
  • R1 and R2 collide with each other and G1, but not B1 or B2.

CollisionGroups

I've been playing around with _Body.CollidesWith = Category.Cat1; and _Body.CollisionCategories = ..., but I'm basically just guessing. Haven't really found any usefull examples in the docs, but I might not have been looking in the right place either.

Edit 1:

Ok, so experimenting some more.

Assuming _Body is B1 (and also applied to B2) in the picture, and Cat1 is G1, and Cat2 is all blue items..

_Body.CollidesWith = Category.Cat1 & Category.Cat2;
_Body.CollisionCategories = Category.Cat2;

Should this not then allow B1 to collide with the ground (G1) and all other blues (B# items)? Applying the above code makes all blue items collide with nothing not even each other...

1

1 Answers

1
votes
_Body.CollisionCategories = Category.Cat1 | Category.Cat2;

instead of

_Body.CollisionCategories = Category.Cat1 & Category.Cat2;