I made such a code a while ago, I hope its that what you're looking for:

Code:
VECTOR kreis_pos;
ANGLE kreis_ang;

while(1)
{

vec_set(kreis_pos,vector(mouse_pos.x,mouse_pos.y,10000));
vec_for_screen(kreis_pos,camera);

my.skill1=c_trace(camera.x,kreis_pos.x,IGNORE_SPRITES + IGNORE_MODELS);

vec_to_angle(kreis_ang,vector(kreis_pos.x-camera.x,kreis_pos.y-camera.y,kreis_pos.z-camera.z));
my.x=camera.x-(-my.skill1)*cos(kreis_ang.tilt)*cos(kreis_ang.pan);
my.y=camera.y-(-my.skill1)*cos(kreis_ang.tilt)*sin(kreis_ang.pan);
my.z=camera.z-(-my.skill1)*sin(kreis_ang.tilt);

wait(1);
}



my is the entity, which follows the mouse.
I think there's an easyer code but maybe you can use it. ^^


Hilf mir, dir zu helfen!