I'm working on an automatic renderer script, and I have some trouble setting the rotation of my camera. I suspect it has something to do with the need for me to convert the rotation values I want to quaternion values. The problem is that I am absolutely hopeless in maths and not very advanced in programming, I'm still learning. I have been looking on the internet but I have found very complex things such as this :
But I don't know where to start, I don't get what the code means and I don't know how to implement that to my case, so I figured it was best to ask from scratch.
SO basically I want my camera to have the same rotation I have created manually, that is to say : x= 66.9 y= 0 z= 28.9
Here's the last thing I have tried:
import bpy
import os
import math
import shutil
import glob
import bmesh
import mathutils
#Camera position
Camera = bpy.data.objects["Camera"]
pos= [24.408, -39.401, 33.853]
rot= [66.9, -0.000115, 28.9]
Camera.location.x = pos[0]
Camera.location.y = pos[1]
Camera.location.z = pos[2]
Camera.rotation_mode = 'XYZ'
Camera.rotation_euler[0] = rot[0]
Camera.rotation_euler[1] = rot[1]
Camera.rotation_euler[2] = rot[2]
Camera.rotation_euler.to_quaternion()
And errr.... it doesn't work at all lol, it puts my camera at 3833° X, -0.00661° Y and 1656° Z...
Can someone help me ?
Thank you so much :)
cam.rotation_euler = [math.radians(r) for r in rot]
is another way to convert. $\endgroup$