# poly-poly collision detection

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

## Recommended Posts

I need a fast method of finding an intersection point and normal between two polyhedras. Do I solve this by dividing each polygon into triangles or is there a better way? There is also an issue of finding the collision normal as the polys can collide in different ways ( face-face, edge-face, vertex-face, vertex-vertex and so on )

##### Share on other sites
Take a look at this:
http://www.geometrictools.com/

There you can find a lot of different algorithm for collision detection.

Best regards
Kimmi

##### Share on other sites
couldn't find anything about poly-poly collision there, lots of good code though.

3D or 2D

##### Share on other sites
Hm, you can try this paper from the hp:
http://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf

Best regards kimmi

##### Share on other sites
Quote:
 Original post by oliii3D or 2D

3D

I do know how to get the intersection point, but I want to know if there are faster ways to do it.
For now I divide polys into triangles, but I think it would be alot faster if I found a way to only do one collision check againts the whole poly.

Now computing the collision normal is my biggest problem. For example if there is a vertex-vertex collision, what is the collision normal of that? same for edge-edge.

##### Share on other sites
edge edge is simply the cross product of the two edges.

vertex-vertex would be the line passing through both vertices.

tnx oliii

##### Share on other sites
Store each objects geometry in a tree, and then compare the trees against each other this can dramatically reduce the number of compares you perform.

##### Share on other sites
Quote:
 Original post by glSmurftnx oliiihow about vertex-edge collision then?

line passing through projection of the point onto the edge towards the vertex.

Vector V; // vertex
Vector E0, E1; // edge
Vector W; // result (which is also closest point on the edge towards the vertex).

Vector D = V - E0;
Vector E = E1 - E0;
float ed = D.DotProduct(E);
float e2 = E.DotProduct(E);
float t = ed / e2;
t = (t < 0.0f)? 0.0f : (t > 1.0f)? 1.0f : t;

W = E0 + t * E;

-> Normal of collision

Ncoll = (W - V).Direction();

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

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

• Total Topics
634090
• Total Posts
3015430
×