Well,it's ur code is very logic but i guess i did something wrong...still doesen't works.
(vec_to_angle(guard.pan,mouse_dir3d);
<- i did it like this becos in another command to set bullet.pan = guard.pan;My code looks like this now:
function fire_bullets()
{
VECTOR bullet_pos;
vec_for_vertex(bullet_pos, guard, 6);
ent_create("bullet.mdl", bullet_pos, move_bullets);
while(1)
{
VECTOR temp;
temp.x = mouse_pos.x - bmap_width(crosshair_pcx)/2;
temp.y = mouse_pos.y - bmap_height(crosshair_pcx)/2;
temp.z = 5000;
vec_to_screen(temp, camera);
c_trace(guard.x, temp, 0);
vec_set(temp, target.x);
vec_sub(temp, guard.x);
vec_to_angle(guard.pan, temp);
// vec_to_angle(guard.pan,mouse_dir3d);
wait(1);
}
}
vec_to_angle(guard.pan,mouse_dir3d); try with commenting this out, you set the pan of the guard again on the pan of mouse_dir3d which is the upper left corner of your mouse map.
With this
vec_to_angle(guard.pan, temp); you set it to the middle of the crosshair how i understand this.
If you then use bullet pan = guard pan, it should work i think