Jump to content
  • Advertisement
Sign in to follow this  
glSmurf

poly-poly collision detection

This topic is 4835 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

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 this post


Link to post
Share on other sites
Advertisement
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 this post


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

Best regards kimmi

Share this post


Link to post
Share on other sites
Quote:
Original post by oliii
3D 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 this post


Link to post
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.

Share this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by glSmurf
tnx oliii

how 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();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!