3D collisions of convex shapes - MPR, SAT, ?

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

Recommended Posts

Okay so I didn't want to cram the forum up with more topics on collision detection, so I'm editing this topic, originally about clarification about Arvo's Sphere - Box Collision Detection. Now I have Box - Sphere collision done, I'm tackling convex shapes collisions. (for reference the original topic post has been minimalized at the end of the post in quotes.

BIG EDIT: it seems I completely misunderstood what anything referring to minkowski was.
Thanks to this page I realized how stupid I was being http://www.pfirth.co.uk/minkowski.html
So now am I right in assuming, this will find if 2 convex objects are colliding?
 List<Vector3> Sum = new List<Vector3>(); Vector3 Center = Position - Other.Position; foreach (Vector3 Vec in Vecs) { foreach (Vector3 OthVec in Other.Vecs) { Sum.Add(Vec + OthVec); } } /* if 0,0,0 is inside Sum return true */ return false; 
Any and all help is appreciated,
Bombshell

ORIGINAL POST:
[size=1]As the title suggests, I'm trying to fully understand Arvo's Sphere - Box Collision Detection.
I'm using the modified version explained in this paper, http://www.mrtc.mdh....hics/paperF.pdf
I figure there is no point in using someone elses theory if I don't fully understand it. Here is my implementation in C# inside of the AABB class
-snip-
Key part to take from it is
 if ((tempDist = Other.Position.X - VecMin.X) < 0) { if (tempDist < -Other.Radius) { return false; } progDist = progDist + (tempDist * tempDist); } else if ((tempDist = Other.Position.X - VecMax.X) > 0) { if (tempDist > Other.Radius) { return false; } progDist = progDist + (tempDist * tempDist); } float r = Other.Radius * Other.Radius; if (progDist <= r) { return true; } 

But the part I don't fully understand is progDist, I named it this because I'm assuming it has to do with a progressive distance.
Could someone explain its significance and why tempDist is squared before being added?[/quote]

Share on other sites
It seems to me that progDist is simply calculating the square of the distance, as the distance is equal to sqrt(x[sup]2[/sup]+y[sup]2[/sup]+z[sup]2[/sup]). My first impression of the pdf you linked to is that this is measuring the distance from the center of the sphere to the nearest corner of the box, with additional checks to reject cases where there can't be any collision (such as if the sphere has a radius of 2 and is centered on the origin, and the box has a minimum x-value of 3).

Share on other sites
as was my suspicion, I was mainly confused about the squaring of the values, but I've realized the way I first imagined it was wrong to an extent.
Thanks for the help

Share on other sites
I'm writing out MPR based Convex Shape to Convex Shape collision now.
My approach in pseudo will be
 Origin = Average(Shape1.Center, Shape2.Center); N0 = Normalize(Origin - Shape1.Center); //Finding Normal and Vectors Vector0 = Zero; Distance = 1000; for each (SupportPoint Point in Shape1.SupportPoints) { temp = Distance(Point,N0); if (temp < Distance) { Distance = temp; Vector0 = Point; } } N0 = Normalize(Vector0, Shape1.Center) //Find Normal and Vectors the same way but using normals tilted from the current one //Now assuming first set of Vectors found Normal = Cross(Vector1 - Vector0, Vector2 - Vector0); if (Dot(Normal, Origin) <= 0) { return true; } // repeat process until no other checks possible return false; 

I'm fairly sure I'm missing something, this seems like it would be very sluggish.
Please let me know if I'm not thinking about it the right way or if I have anything wrong.

Share on other sites
it seems I completely misunderstood what anything referring to minkowski was.
Thanks to this page I realized how stupid I was being http://www.pfirth.co.uk/minkowski.html
So now am I right in assuming, this will find if 2 convex objects are colliding?
 List<Vector3> Sum = new List<Vector3>(); Vector3 Center = Position - Other.Position; foreach (Vector3 Vec in Vecs) { foreach (Vector3 OthVec in Other.Vecs) { Sum.Add(Vec + OthVec); } } /* if 0,0,0 is inside Sum return true */ return false; 

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 13
• 10
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633692
• Total Posts
3013355
×