See here:
http://www.conitec.net/beta/mouse_pos3d.htm
Move the entity to the target position of the c_trace instruction. You can do this easily on plain terrains/ maps without c_trace too by solving the equation
0 = t*mouse_dir3d + camera.x; // this is a vector equation
(-> t = -camera.z/mouse_dir3d.z; then calculate the result using that t and the above equation)


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends