[problem] Ray-Line selection with triangles

Posted 11 March 2013 - 05:11 PM

Hi eveyone, I'm in great need of help here... I've been trying to make a selection system working with the camera and a normalized vector pointing in front of the camera... In other words, check if there's a collision with a triangle and a line. Unfortunatly, it doesn't work as good as I though and I'm having a hard time finding the errors/things I'm doing wrong!

What I'm seeing :

- It detects that I'm looking in the right direction, but only at a distance of approx. 1 from the plane.
- It only detects that I'm lloking in the right direction when I'm looking in between -45 and 45 degrees on the x axis (looking up/down)
- I never get the "collision" result...

Here's the bit of code where I check for a plane intersection with the line :