Archived

This topic is now archived and is closed to further replies.

smidge_tech

Irregular collision detection

Recommended Posts

I''m using OpenGL, and I''m loading a level as a series of polygons, all with faces. I want to know how to do perfect collision detection on surfaces (some will be irregular, i.e. leaning in different directions) when I have a list of the vertices on the face I''m going to test. I''ve already done it with straight ramps that all face regularly, but after that it gets a bit complicated! Help! ======== Smidge www.smidge-tech.co.uk ========

Share this post


Link to post
Share on other sites
Uhg, polygon collision is so tedious, I won''t even try to put the entire algo here. Here''s basically how I''ve seen it done, though (for determining if a point has collided with a face):

1) Test if the point is within the "radius" of the face, that is, within the radius of the smallest sphere than can enclose the polygon (pre-compute the faces'' radii).

2) Determine if the point has crossed the plane of the face. I think you get the plane equation from the face''s normal; plug the point into the equation and look at the sign of the result.

3) You could possible just stop here, if all your faces are small and somewhat "circular". Otherwise, for each side (2D line) of the face, test if the point is on the "inside" of the line. Again, get the equation for the line, plug in the point, and look at the sign of the result.

Share this post


Link to post
Share on other sites