How do you calculate pitch & yaw for a camera so that it faces a certain 3D point?
Variables
- Camera X, Y, Z
- Point X, Y, Z
Current Half Solution
Currently I know how to calculate the pitch, and I do that using the following.
$dx:=camera_x-point_x$
$dy:=camera_y-point_y$
$dz:=camera_z-point_z$
$pitch:=atan2(\sqrt{dz*dz+dx*dx},dy))$
Then if $(dy>0)$ pitch gets negated. ($pitch:=-pitch$)
The Main Question
So how would I go about calculating the yaw?
Edit
This is the orientation of my axis.

(source: wikispaces.com)
Answer - Thanks to Omnomnomnom
$dx:=camera_x-point_x$
$dy:=camera_y-point_y$
$dz:=camera_z-point_z$
$pitch:=-atan2(dy, \sqrt{dx*dx+dz*dz})$
$yaw:=atan2(dz,dx)-90^\circ$