# set yaw, pitch and roll for camera

I want to do two things:

Set the yaw, pitch and roll of the camera and the reverse, extract yaw, pitch and roll from the camera.

I got some confusions using the rotations in Blender. I use the Euler rotation modes. As I understand, for example XYZ Euler means first a rotation around the local (and global) z axis, followed by rotation around the global Y and then X axis. Thus, to set yaw pitch roll for a normal object, one would use YXZ as z is the yaw, x the pitch and y the roll. The problem comes when using cameras: For cameras the typical z axis (pointing upwards) would be the y axis, while x is still pitch and z is roll. However, it does not simply work to use ZXY Euler since one has to first turn the camera about 90 degrees in x direction to align local y and global z axis.

Does anyone know to to solve this problem? Is it for example possible to change the axis system of the camera?

• If we look through your ideal camera, does X point right, Y point up, and Z point towards us? May 11, 2018 at 15:25
• @Leander. That is how it is at the moment. Is it possible to switch Y and Z? Any other solution would also be welcome. May 11, 2018 at 15:30
• Ok, so you want X to point right (pitch), Y to point towards us [not away!] (roll) and Z to point up (yaw), correct? And when changing the Roll, the other axes don't change, and when changing the pitch, the yaw axis doesn't change. Then yaw axis changes both other axes, correct? May 11, 2018 at 15:33
• thats correct: I basically want to be able to read of yaw pitch and roll from the rotation_euler property, which is not possible because if the camera rotation is (0, 0, 0), the camera faces down. May 11, 2018 at 15:42