2d mouse,3d object, how do I tell mouse is over it

like Homeworld’s ships selection, how could I tell where 3d objects are located in 2d space?

You could shoot a ray from the location of the mouse cursor in the world (convert mouse coordinates to world by mapping plane of mouse onto the nearplane and so forth) in the direction ‘parallel to the view perspective’ and see what object the ray first collides with. You could probably also do it using the selection buffer, though that seems a mighty bit more expensive.

[This message has been edited by DFrey (edited 06-18-2000).]