Contact points not available in ManifoldPoint struct


In C++, the ManifoldPoint struct contains the position of the contact point in local coordinates for each of the bodies involved in the contact.
The C# port of ManifoldPoint does not contain this important information.
Closed Jan 17, 2010 at 11:57 AM by nfurtwangler
Our port is accurate with r32 of Box2D on google code which does work a bit differently than the 2008 version referenced in this issue.


nfurtwangler wrote Jan 17, 2010 at 9:05 AM

Which revision of the C++ version are you seeing differences on? Can you describe a reduced repro so we can investigate?

It's possible we missed something in the port, but from a brief comparison of the latest code of each I don't see anything that stands out.

frozax wrote Jan 17, 2010 at 10:41 AM

I hope I don't miss something obvious here but here is what I found out:

When browsing the Box2D.XNA file Collision.cs, here is the ManifoldPoint struct:
public struct ManifoldPoint
    public Vector2 LocalPoint;      ///< usage depends on manifold type
    public float NormalImpulse; ///< the non-penetration impulse
    public float TangentImpulse;    ///< the friction impulse
    public ContactID Id;            ///< uniquely identifies a contact point between two shapes
On Box2D C++ 2.0.1, the b2Collision.h contains the ManifoldPoint struct with the following declaration:
struct b2ManifoldPoint
b2Vec2 localPoint1;     ///< local position of the contact point in body1
b2Vec2 localPoint2;     ///< local position of the contact point in body2
float32 separation;     ///< the separation of the shapes along the normal vector
float32 normalImpulse;  ///< the non-penetration impulse
float32 tangentImpulse; ///< the friction impulse
b2ContactID id;         ///< uniquely identifies a contact point between two shapes

Both local contact points are available in C++.

Also, for instance, if you look at in the Collision.CollidePolygonAndCircle (C#) and the b2CollidePolygonAndCircle (C++) functions, you can see differences. At the end of the C++ function, the contact point is computed properly using b2Vec2 position = c - radius * manifold->normal; I can't seem to find anything similar in the C# port. In C#, only the circle._p value is stored in the LocalPoint but this is not a contact point.

I hope my explanation is clear.

frozax wrote Jan 17, 2010 at 10:50 AM

Ok, I just realized the link on box2d.org points to sourceforce and the C++ version I read is a 2008 version. You are porting the version that is on googlecode. So, well, I'll find a way to compute my contact points based on the new version. Sorry about that.

nfurtwangler wrote Jan 17, 2010 at 11:56 AM

OK, yes Box2D moved to Google code and all the latest changes are made there (and these are the latest changes that our port is synced to). I'll close out the issue but if you find that there is a loss of functionality between the C++ version you were using and the latest version then definitely file an issue on the Google code version here: http://code.google.com/p/box2d/issues/list

Also if you spot any differences in our port compared to the Google code version then please continue to file issues here.

  • Nate

wrote Jan 17, 2010 at 11:57 AM

wrote Feb 14, 2013 at 8:22 PM

wrote May 16, 2013 at 10:05 AM