How can I determine the contact point of a collision?

Topics: User Forum
Mar 29, 2014 at 10:51 PM
I have two Farseer bodies. A static rectangle and a dynamic ball that is flying around. I want to determine where the ball touched the rectangle. I need the exact coordinates of the contact point.

How can I do that? Is there a way to determine the contact point?

Apr 2, 2014 at 7:23 PM
In whatever you use to handle collisions you have the contact data. Contact.Manifold.Points or Localpoint could be a starter, I'm a bit unsure myself.
Marked as answer by Wizard999 on 4/3/2014 at 8:26 AM
Apr 3, 2014 at 3:26 PM
It works.
bool BlueRectangle_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
       if (fixtureB.Body == RedBall)
          Vector2 normal;
          FixedArray2<Vector2> worldPoints;
          contact.GetWorldManifold(out normal, out worldPoints);

          if(contact.Manifold.PointCount >= 1)
            Vector2 contactPoint = worldPoints[0];

        return true;