Collision detection line / quad

Started by
0 comments, last by RunningInt 18 years, 9 months ago
I want to find out when a line segment passes through a Quad. My project currently is rendered in 3D, but movement limited to 2D sorta side scrolling. I currently use lines for most of my boundieries and collision detection with that is already completed. I just test that line segment from the boundary to the line segment created over the time step for movement. I want to incorporate 1-way walls/floors. My level editor is 3dsmax and I export to my own format. For the 1-way walls I figured I could create quads mainly just extend the line in the Z direction. This means I can then export a normal and turn the quad into plane. I can then use the Dot product to classify if the point is infront/behind the plan. How can I test to see if the point actually cross the quad I used to create the plane. The plane goes on infiniately, but I only want a subsection. Or should I just turn it into a plane to get the classify point, then have a line that corrosponds with that plane and test that line with the movement line from the last timesetp? -THACO
Advertisement
This is the code im using for line / triangle collision. It has implementation too. Perhaps you could modify it to be line / quad collision. Or you could just treat your quad as 2 triangles and run the intersection function once on each half of the quad.

http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm#Segment-Triangle

This topic is closed to new replies.

Advertisement