#### Archived

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

# Irregular collision detection

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

## 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 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 on other sites
To Eric:

Any sample code I can get anywhere?

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 10
• 23
• 9
• 32
• ### Forum Statistics

• Total Topics
632630
• Total Posts
3007526
• ### Who's Online (See full list)

There are no registered users currently online

×