I finally got it working!
xXxGuitar, your code was absolutely correct.
However, vec_rotate doesn't seem to work as expected in this particular case.
As far as I know, the order in which the Euler angles are changed is important.
Obviously, rotating the direction vector by each Euler angle seperatly solves the problem:
Code:
vec_rotate(vec_to_ent, vector(temp.pan,0,0));
vec_rotate(vec_to_ent, vector(0,temp.tilt,0));
vec_rotate(vec_to_ent, vector(0,0,temp.roll));
Thank you all for your help!