I admit, I'm very new to FarSeer physics. I plan on using it for it's collision detection system in an XNA project. I've looked around quite a bit, tried many things and haven't had any luck solving my problem, I hope someone with more experience can help
Essentially, I've created two bodies using BodyFactory.CreateRectangle. In the project I update their positions manually (no gravity or velocity is used), then place the Sprite/XNA rectangle onto the position of the FarSeer bodies. This works fine, using the
ConvertUnits functions the positions match up exactly. The trouble comes when I want the two bodies to collide.
During LoadContent I assign the player body collision a function to call (Player_Body.OnCollision += FarSeer_Collision)
However, when the two bodies collide, this function is never called.
I do not know what I'm doing wrong and I would love some help. Below is how I've created the bodies for the Player and the other object, as well as the FarSeer_Collision that I would like to call when the two objects collide.
Player_Body = BodyFactory.CreateRectangle(world, FarseerPhysics.SamplesFramework.ConvertUnits.ToSimUnits(Players.Rect.Width), FarseerPhysics.SamplesFramework.ConvertUnits.ToSimUnits(Players.Rect.Height), 1.0f, FarseerPhysics.SamplesFramework.ConvertUnits.ToSimUnits(Players.Position));
Player_Body.BodyType = BodyType.Static;
Player_Body.CollidesWith = Category.All;
Player_Body.CollisionCategories = Category.All;
public bool FarSeer_Collision(Fixture f1, Fixture f2, Contact contact)
Is there something else I have to do before the two objects will "collide"? I apologize if this is a simple mistake and would greatly appreciate any advice. I also apologize if this has been asked and solved before, I have searched but haven't had
any luck. I am also more than happy to provide more information if needed.