This project has moved and is read-only. For the latest updates, please go here.

CollisionCategory / CollidesWith problem

Topics: User Forum
Feb 16, 2009 at 9:56 AM
Geom1 => cat1 + colide with all
Geom2=> cat1 + colide with all & ~cat1

I want body1 and body2 not to colide but they do, bum.


Imagine a team of enemy ships (Geom1 type) I want them to run into each other. OK.

They shoot bullets (Geom2 type) I want the bullets to hit anything except a ship on the same team.

Unfortunatly with this set up  the bullets colide with the ships on the same team!

I am not very clever with the & | ~ xor stuff.

Can someone suggest a solution.

Feb 16, 2009 at 10:07 AM
I've made a short description here

You need 2 different categories.
Feb 16, 2009 at 12:38 PM
Hi, thanks for the quick response.

Yeah I was thinking about it in the shower and figured the only way was two catagories.
I was hoping that I could do it with one catagory as that would be kind of neat, and much easier to keep track of in the program.

So I guess I have

Ship.CollisionCategories = CollisionCategory.Cat1;
Ship.CollidesWith = CollisionCategory.All  & ~CollisionCategory.Cat2;

Bullet.CollisionCategories = CollisionCatagory.Cat2;
Bullet.CollidesWith = CollisionCategory.All & ~CollisionCategory.Cat1 & ~CollisionCategory.Cat2;

Thanks for your help.
Farseer is very cool. (sorry I'm old, cool is probably not a cool word anymore)