Contact's Positions

Hey everybody,

I've been trying to figure out how exactly to get a list of the positions of contacts between two objects. It's so that I can find whether the player / character can jump or not, depending on either the difference in Y or the angle. I've tried using the Manifold and the contact's themselves, but the local point is not correct. So how do I find the actual position (Vector2) of the contact, or at least with respect to my character?

Thanks in advance,
El-Presidente
You should be able to get the local point (relative to the body's position) by using the contact's manifold's point list.

So something like this (pseudo-code):

Manifold m = myContact.GetManifold();

Vector2 localPoint = m._points[0].LocalPoint; // Assuming you just take the first point on the contact's manifold

You can convert that to world coordinates by doing something like this:

Vector2 worldPoint = myBody.GetWorldPoint(localPoint).
I have the same problem as El-Presidente.
It seems the LocalPoints variable in the ManifoldPoint struct does not contain the local point of the contact.
I only tested in a circle/box collision but if you read the comment above the declaration of struct ManifoldPoint, it says:
/// The local point usage depends on the manifold type:
/// -ShapeType.Circles: the local center of circleB
/// -SeparationFunction.FaceA: the local center of cirlceB or the clip point of polygonB
/// -SeparationFunction.FaceB: the clip point of polygonA

And unfortunately, the comment is right. For instance, in my case, I get the local center of CircleB in my localpoint, that is pretty useless.

Anyone as more information on this? I don't think the contact point is available or even computable only with a class Contact. There probably needs some code in the collides functions in order to get it.
That's strange, especially since this information is available in the C++ version.

Dave.
Are you guys using Box2DX or Box2D.XNA?

Box2D.XNA is in sync with the latest version of the C++ code, so it shouldn't be different. If you find that it is, please file a bug on codeplex: http://box2dxna.codeplex.com/WorkItem/List.aspx
Thanks for the reply Brandon,
I do think it's not in sync here. I filed a bug.
I took some time to debug the problem and the bug is in the following method:
public void GetWorldManifold(out WorldManifold worldManifold)

Here:
Transform xfA, xfB;
bodyA.GetTransform(out xfA);
bodyA.GetTransform(out xfB);

Of course, the last line should be bodyB.GetTransform(out xfB);
Great find forzax.

Fix with codeplex change 37320.
Yep forzax is great!
astigmatism

Original thread: https://box2d.org/forum/viewtopic.php?t=4186