Getting the rotation of camera in Euler Angles
29 February 2016 12:41
29 February 2016 18:37
This is returning a quaternion. However, I need this rotation value back into blender to set the rotation of a new camera.
You can still use it in Blender. Just set the rotation mode and the rotation quaternion on the camera as follows:
camera.rotation_mode = "QUATERNION" camera.rotation_quaternion = new_quat
Also, the Quat can be converted to Euler by using this method. It depends on the angles' order which rotation mode should be set before applying the rotation in Eulers.
However, b4w quaternion should be prepared first, because of different order of its components. Let's assume that it has the following order: [x,y,z,w]. Then in Blender you should use it like this [w,x,-z,y]:
new_quat = mathutils.Quaternion((b4w_quat, b4w_quat, -b4w_quat, b4w_quat))