This project has moved. For the latest updates, please go here.

Collide vs CollisionCategory possible Bug

Topics: Developer Forum, Project Management Forum, User Forum
Apr 6, 2010 at 8:11 PM

I ran into something really strange that screwed me up for several hours regarding CollisionCategories and the use of the Geom1.Collide(Geom2) routine.

I had created several classes for various objects in my game...Player, Terrain, Obstacles etc. 

Using CollisionCategories in these different class to keep track of object collisions was working fine across classes except in one class.

For some reason, Farseer objects in my Obstacles class were either colliding with everything or colliding with nothing.  It didn't matter what I set the CollisionCategory enum to  or what logic I would not work.  I could not make it distinguish between any categories.  All I could use was .CatAll or it would collide with nothing.   Any logic at all applied to the CollisionCategory enum tree caused it to collide with nothing. 

I was using the OnCollision Event in the Obstacles classes just as in all of my other classes.

It turned out, further down in my Obstacles class,  I had used a simple Farseer collision check using using the Geom1.Collide(Geom2).  I was doing that .Collide check on the same Geom that I was trying to use the OnCollisionEvent and CollisionCategories on.

Once I commented this out my use of Geom1 .Collide(Geom2), my CollisionCategories with OnCollision Event started working fine.

So my question is.....

Does the .Collide method somehow completely override the use of CollisionCategories and the Oncollision Event.  Is that a bug or is it by design?