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

Topics: Developer Forum
Nov 9, 2012 at 5:38 AM
Edited Nov 9, 2012 at 2:39 PM

Solution:

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.

Screenshot

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);


Coordinator
Nov 9, 2012 at 1: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 1: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 1:43 PM

Thanks so much Genbox

Nov 9, 2012 at 2: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