Saturday, 17 August 2013

Calculate Camera Pitch & Yaw To Face Point

Calculate Camera Pitch & Yaw To Face Point

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?

No comments:

Post a Comment