Selecting 3D Objects--Picking
3D model to screen--series of transformations
screen to 3D model--reverse transformations
end up with "ray"
find out what ray runs into--How?
This code takes the x and y screen coordinates and gives back x, y,
and z world coordinates.
I use it to find the x and z coordinates of the point where the pick ray
intersects the plane y = 0.
The board in my 3D battleship game is on the y = 0 plane, so I can use
this function to find out what square on the board they clicked on.
Note: I use this function as a member function in a display class
so there are a few variables (like displayWidth and displayHeight) that
you will need to define or change.
Projecting a Ray from 2D Screen Coordinates
Note that this article uses DirectX 7 so there are several things in it
that won't work in DirectX 8.
It does explain the basic idea of picking better than the next example,
which doesn't have much explanation.
Improved Ray Picking
This article has good sample code but it is a fairly general solution
and more complicated than you need for something like a 3D implementation