I'm trying to set the camera to always look the origin of the scene and then I want to rotate the camera about the origin to get a new camera pose (i.e. rotate the empty point the camera is looking at in the origin).
This works when I do it without a loop:
b_empty = scene.objects["Empty"]
b_empty.rotation_euler[2] += math.radians(360/20)
print(cam.matrix_world)
But when I do it in a loop it doesn't work and the camera stays the same (same print for cam.matrix_world)
for i in range(20):
b_empty = scene.objects["Empty"]
b_empty.rotation_euler[2] += math.radians(360/20)
print(cam.matrix_world)
what could be going wrong?
cam
in your script. Why do you expect it to change? Also why do you need the loop? What are you trying to achieve here? $\endgroup$obj.rotation_mode = 'XYZ'
and runbpy.context.view_layer.update()
before you access the matrix. $\endgroup$