0

what I'm trying to achieve is to get angles from an anim. It's just an elongated cube at the world origin that spin 360° along its Z axis, and the world's. It's 361 frames to account for the loop in the script. I expected to have my values of 1.57, 3.14 etc on respective frames, but here's what I got in the terminal:

0 Cube 0.18372902274131775
90 Cube 0.0
180 Cube 1.5707963705062866
270 Cube 3.1415927410125732
360 Cube 4.71238899230957

with the frame number, Mesh name and angle. It's weird that the first frame has 1.83 etc radians while it should be zero, frame 90 0.0 and frame 360 4.71... while I expected it to be some 6.18... rad. I tried changing from Euler to quaternions or to Axis, which yielded the same results ; I tried to change interpolation, but to no avail. Here's my code :

import bpy
import os
from math import degrees as deg # better stick to rad anyway
# inspired from https://blender.stackexchange.com/questions/34859/execute-python-script-between-rendering-animation-frames
s = bpy.context.scene
objects = s.objects

for i in range(s.frame_start,s.frame_end,90):# 90 because I only look at angles rn s.frame_current = i for obj in objects : if obj.type == 'MESH': z = obj.rotation_axis_angle[0] print(i,obj.name,z) else : pass

s.render.filepath = (
                    "/tmp/" 
                    + str(s.frame_current )
                    )
bpy.ops.render.render( #{'dict': "override"},
                      #'INVOKE_DEFAULT',  
                      False,            # undo support
                      animation=False, 
                      write_still=True)

What am I doing wrong ?

morphik
  • 41
  • 7

0 Answers0