I have this code for plane-ray intersection: http://pastebin.com/2VuPeZ5r
I think I compute t correctly, but I need to return null if there is no intersection.
How do I check that?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean by “no intersection”? Any ray will intersect a plane somewhere, except for the degenerate case where the ray is exactly perpendicular to the normal of the plane. To detect that case, test for
Vector3.Dot(Norm, ray.Dir) == 0.If you want to know if the intersection is in front of or behind the ray origin, test for
t > 0.