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

Collision difficulties

Topics: User Forum
Jul 30, 2011 at 4:36 AM
Edited Jul 30, 2011 at 9:21 AM

Greetings, I'm having a problem with collisions in my program.

I have a homing projectile that returns false in it's OnCollision method unless it's hitting it's target.

I also have a sphere which it is colliding with despite the fact that it is not the projectile's target.

The projectile passes through all other objects and when I swap out the sphere for a rectangle it passes through the rectangle.

Here are 2 pieces of code, the top collides properly while the bottom does not.

//wheel = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(mSpriteTexture.Width * Scale), ConvertUnits.ToSimUnits(mSpriteTexture.Height * Scale), 1f, ConvertUnits.ToSimUnits(position));

wheel = BodyFactory.CreateCircle(world, (float)ConvertUnits.ToSimUnits(width / 2), 1);

This is my first project in Farseer, thanks for any help.