Sign in to follow this  

Generating contact point from EPA Convex Hull [SOLVED: See comment for solution]

Recommended Posts

Hi, people. This is another thread by me about generating collision contact with EPA. For now, my method is one shot full contact manifold generation. But I thought I ever saw someone said that I can get a single contact point using the EPA convex hull (aka the resulting polytope). He said something about transforming the closest EPA triangle into world space. I can't wrap my head around it, because as I know it, the vertices of said EPA Triangle are made of minkowski difference between the two shape (in world space configuration, of course). And then, how do I transform the EPA Triangle into world space? Which shape's transformation matrix do I use or how do I combine them (because there are 2 shapes, so there are two transformation matrices)?

Share this post


Link to post
Share on other sites
I have never implemented EPA, but I believe you can use barycentric coordinates along with distance to plane. The idea is to encode coordinates relative to features from input shapes A and B. Then the point of contact can be constructed from the encoding in whatever space the feature is transformed to. Here features mean verts, edges and faces of a convex hull.

Share this post


Link to post
Share on other sites

That's what I'm confused at. Logically, the Polytope result from EPA is the convex hull of shape A and B (in minkowski difference though). So it follows that the closest triangle to the origin contains the collision point (it is the only triangle we're interested at). I already got the triangle. I already did compute the origin's projection's barycentric coordinate, in which once I get the triangle in world space, I could simply get the collision point by calculating

 

tA * u + tB * u + tC * w (u,v,w: barycentric coord. tA, tB, tC is the vertices of EPA Triangle). What I don't know is the transforming of EPA Triangle (minkowski difference space) into world space. Googling doesn't help though.

 

EDIT: half dizzy typing, scrambling words. sorry.

Edited by Bow_vernon

Share this post


Link to post
Share on other sites

SOLVED IT!!!

Turns out it's a pretty simple, actually. So whey you're building the minkowski difference, you don't simply store the support point

 Support (ShapeA, dir) - Support (ShapeB, -dir)

But you actually need to store the support points themselves. Then, when EPA runs (blowing up simplex), you also do the same (store the support point in A and B -- they are in world space).

 

Finally, when you terminate from EPA, you must have found the closest EPA triangle from the origin. Simply compute barycentric coordinate of projected origin on that triangle, and then:

  1. you can calculate world space contact point of Shape A --> using the support point A stored along the CSO vertex
  2. you can calculate world space contact point of Shape B --> using the support point B stored along the CSO vertex

but that only gives you single contact point, you need to cache and building a manifold over the frame. As for the caching scheme, many exist. I for one use simple distance based caching. And only remove separating cached contact (i.e., contact point A and contact point B are no longer overlap).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this