I am using Newton 2.0 beta on the iPhone, basically to perform mouse picking on some objects. I used the mouse picking code provided with the samples as reference, but I don't seem to be able to get the values correctly.
After receiving a touch event on the screen, I am using gluUnProject (throught the iGLU library) to get the ray coordinates in the near and far clipping planes. Once I have the ray, I use NewtonWorldRayCast to get the picked body which is closest to the camera.
If I get it right, the way in which the RayCastFilter callback works is that, the closest point of the ray is assigned a value of 0.0, and the far point of the ray is given a value of 1.0. The intersectParam value of the function receives a value between 0 and 1 which is the normalized distance from the origin at which the collision occured.
So, following the sample code, I have the closest ray point in a dVector named p0, and the disntant point in a vector named p1. By doing dVector p( p0 + (p1 - p0).Scale( intersectParam ) ), I should get the exact point of collision, isn't it? The problem is that the resulting value is not at the point of collision as it is expected, but closer to the camera instead.