• Advertisement
Sign in to follow this  

Line intersecting a face

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

Hello.

I am creating a game and I am currently working on collision detection. My problem is the following:

If I have a 2D face (in 3D space) with num_vertices vertices, and an array of vertices named "vertices", how would I check if a line crosses through this face?

All help appreciated. Edited by Madd

Share this post


Link to post
Share on other sites
Advertisement
Hmm, good question. This is the easiest to do with triangles, I think.
I done a little raytracing a long while ago, and this question came up when I was trying to build a little engine. I've forgot the specifics of the implementation, but don't worry, there is plenty of information out there. For example here and here.

If you want to do this for arbitrary polygons you may want to triangulate them first, but again, I forgot the specifics, so I'll leave it up to you to do some research. A little linear algebra skills may come in handy if you want to understand what's going on (or even try to find a way yourself).

Share this post


Link to post
Share on other sites
Do a simple ray-plane intersection test. Then in case of intersection, test if that point lies within your polygon.

Share this post


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

  • Advertisement