I just tested your code, it doesn't work.

DOH. :-/

Did you also test the code I sent you in the PM and it still doesn't work?

Also what method are you using (I really don't understand any the code too much), is it this method you are using?

http://geomalgorithms.com/a06-_intersect-2.html

Nope, the method I use is based on solving linear systems of equations. I might upload some explanation later.

Right now I'm trying to figure out how a, b and c are being represented as the plane, because the math that you used to make the plane defined by the triangle is exactly the same as the code I used for finding the normal of the triangle (by getting the cross-product). But you cannot have a plane with the normal, you need a point as well to define the position (I use the first vertices read because its quick and easy, it doesn't matter which it is anyways).

You forgot 'd'. (a,b,c) is indeed the normal of the plane. But, a*x+b*y+c*z=d is what describes the actual plane. I put it in a linear system with the other equations (lines etc) and new results are produced. The assignments I do (abcd,a1a2 etc) are actually the solutions of the linear systems.

No, of course I didn't solve them myself. get wxMaxima from here:

http://sourceforge.net/projects/wxmaximaThe code for finding the collision point is correct, I've tested it many times. Now, what happens with the code for checking if it belongs in the triangle... that's another weird problem.

EDIT: wait, what do you mean 'the collision spot is smaller than the actual triangle'?