Sign in to follow this  

Collision Points

This topic is 4746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I've implemented some Seperation of Axis collision detection using olii's (great) tutorial. I'm just having some problems working out/understanding how you go about find the actual contact points. I was wondering if someone could clear up the maths behind it a little that would be a big help. Atm I can detect collisions and calculate a push vector to seperate the objects. P.S - Sorry for starting a new thread, but when I went to reply to one that I found in search it kept taking me back to the forum list? Cheers. Mark

Share this post


Link to post
Share on other sites
it should be covered later on. Tutorial 6 I believe. If that confuses you a bit, simply put, it's a matter of finding the vertices that are 'supporting' the polygon along the normal of collision. SO, the vertices on the polygon that, when dot producted with the normal, will give the highest values. Or the lowest values, depending which polygon you test.

if you have a point-edge collision, then obviously, you have one collision point, and tht point will be the supporting vertex. then there is no need to go further.

Else, in case of an edge-edge collision, wheer you have two edges supporting the two polygons, you need to clip those edges with each other.

to do that, you work along the vector perpendicular to the normal of collision (thus, that vector should be aligned with the edges directions). Projecting the points on that vector, you take the two middle points as your contact points. In case of an overlap, the pairing points (contact points work in pair during overlaps), you simply add ot substract the MTD to the contact point. That should give you the pairing contact point. In the end, you will have two contacts for an edge-edge collision.

The principle in 3D is identical. Identify the vertex/edge/face supporting both convex objects, and clip the features against each other. Then it falls down to clipping an edge with a polygon, or two polygons together to get the contact points.

Share this post


Link to post
Share on other sites
If you know the objects are intersecting, and the separating axis test has given you a penetration depth and direction, you can get a list of the intersection points by (in 2D) intersecting each edge of one object with each edge of the other object (you can eliminate some of these tests very quickly) and vice versa. In 3D test each edge of one object against the faces of the other object, and vice versa. For boxes these tests can be very fast if you transform one box to be axis aligned.

This will give you all the points you need, but in 3D especially you may get more than you want. So run the list of points through some reduction algorithm - e.g. grouping contact points that are very close together, and (in 3D) only using points on the convex boundary of the points in the plane perpendicular to the penetration direction (in 2D just use the extreme 2 points in the direction perpendicular to the penetration direction).

Share this post


Link to post
Share on other sites

This topic is 4746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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