You don't need to go private messaging because of this, what comes told may be useful to someone else later. So i'll answer here too...
Firstly full source of my 3D engine and demos which include mouse-ray demo with 3D model are here: http://next3d.webs.com/
The code itself is really copy-paste stuff. You don't need to deeply understand how it works, just what parameter are needed and result they give. This might explain a little more:
Code:
type
TVector = record x,y,z: single; end;
PVector = ^TVector;
function vector(const x, y, z: single): TVector;
begin
result.x:=x; result.y:=y; result.z:=z;
end;
function TNXGL.MouseRayAtXZPlane(const mx, my: single): TVector;
begin
result:=MouseRayAtPlane(mx,my,Vector(0,0,0),Vector(0,1,0));
end;
So in order to get point (x,y,z) at airfield you need to call only
pointAtAirfield:=MouseRayAtXZPlane(mouseX,mouseY);
...where pointAtAirfield is TVector type.
Also notice that with OpenGL you may have to flip mouseY coordinate around because 0,0 is bottom left. DisplayHeight-mouseY.
Bookmarks