To do this properly you need somebody who is comfortable with dot product calculations because essentially you need to project the vector of the target upon a plane which is attached to the player's pan. Then determine what degree of roation it is relative to that plane.

(To be honest I never could quite wrap my head around it enough to code it wink