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

[Solved] No overload for 'OnSensorCollision' matches delegate 'FarseerPhysics.Dynamics.OnCollisionEventHandler'

Topics: Developer Forum
Nov 9, 2012 at 6:38 AM
Edited Nov 9, 2012 at 3:39 PM


I imported the wrong Namespace: Microsoft.Phone.UserData instead of FarseerPhysics.Dynamics.Contacts

I hope this problem will be useful for others who will encounter my problem.


I really don't have an idea what's the problem here.


Raw Code



private bool OnSensorCollision(Fixture f1, Fixture f2, Contact c)
      return false;

Body sensorCircle = BodyFactory.CreateBody(World, _ball._body.Position);
sensorCircle.BodyType = BodyType.Static;
sensorCircle.CreateFixture(new CircleShape(10, 0f));
sensorCircle.FixtureList[0].IsSensor = true;
sensorCircle.FixtureList[0].CollisionCategories = Category.All;
sensorCircle.FixtureList[0].CollidesWith = Category.All;

sensorCircle.FixtureList[0].OnCollision += new OnCollisionEventHandler(OnSensorCollision);

Nov 9, 2012 at 2:41 PM

The method you made does indeed match the signature of the OnCollision delegate. Make sure that there are not problems in compiling Farseer Physics, and make sure you don't have other compilation issues.

Nov 9, 2012 at 2:43 PM

That's why it's so weird for me realizing there's no problem with the code but why is it giving me an error. Will try it in Visual Studio 2010 and also build your source again.

Nov 9, 2012 at 2:43 PM

Thanks so much Genbox

Nov 9, 2012 at 3:14 PM

Hello Genbox, I am really having a serious problem. I have tried downloading the source again, built it, re imported the reference FarseerPhysicsXNA.dll, rebuilt the solution and project and still the same problem. I am requesting you to give me your dll that works? Please