2D SAT, contact Points

Learn to google?

PS. honestly something like gamedev would probably give you better responses on topics like this.

Thanks for the link but tutorials like that are all over the net. It does not say how to determine the exact contact set though. I did manage to determine the contact set using the following algorithm:

1 -> Find the point(s) on object 1 that cause MAXIMUM projection values onto the minimum translation vector.
2 -> Select one of these points and calculate plane information (normal, distance), and test to see if the objects are separated by this plane
3 -> If they are NOT separated go to 4, if they are go to 5
4 -> Find the point(s) on object 1 that cause MINIMUM projection values onto the minimum translation vector, go to 5
5 -> Find the point(s) of object2 that lie onto the plane
6 -> If either the support features determined has 1 point return that as the contact point else go to 7
7 -> NewMTDVector = Vector3(MTDVector.y, -MTDVector.x) (this will yield an edge direction). Calculate a plane with this normal and located in the origin. For all the 4 points (one edge from the first object and one from the second object), calculate the distance to the plane and sort them based on this distance, choose the second and third point as the line of collision.

I was just wondering if there was a better approach than mine, posting on gamedev.net did not yield any useful responses and i was thinking if anyone here could confirm that there is a better way or if there's a flaw in my algorithm.

Thanks,
Adrian
 
Bleh, in retrospect I think the link I gave was incorrect anyway ... I agree with the objection from twobitshift in the comments there. You have to maintain T-begin/end for overlaps, there is only a real collision if max(T-begin)<min(T-end), while the code assumes that having overlaps on all SATs during any time period is enough. Since you mention minimum translation vector I assume you are working from the code from that tutorial? (If so, sorry if I steered you wrong.)

Should have just pointed to the grand daddy of basic 3D code on the web, Roger Eberly ... his code for triangles is trivially extendible to convex polygons (the cases mentioned on page 10 are no longer correct, with a convex polygon two vertices can project to both the maximum and minimum and a lot more to the interior but the basic method stays the same) and has the advantage of being correct.
 
Last edited by a moderator:
Back
Top