Basic question about rotations

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
robal
Posts: 0
Joined: Tue Jul 02, 2013 9:53 pm
Location: Poland

Basic question about rotations

Post by robal » Fri Jul 26, 2013 3:11 pm

Hi

I've got very simple script to do animation:

Code: Select all

import bpy
import math
import mathutils

active = bpy.context.scene.objects.active
active.matrix_world = mathutils.Matrix.Rotation(math.radians(14), 4, mathutils.Vector((1, 0, 0)))
active.keyframe_insert(data_path="rotation_axis_angle", frame=1)
active.matrix_world = mathutils.Matrix.Rotation(math.radians(28), 4, mathutils.Vector((1, 0, 0)))
active.keyframe_insert(data_path="rotation_axis_angle", frame=50)
Now, when i check rotations via Axis Angle in UI for frame 1 and 50, i've got values:

frame 1:
W: 0.244
X: 1.000
Y:-1.000
Z: 0.000

frame 50:
W: 0.489
X: 1.000
Y:-1.000
Z: 0.000

Of course, object is not rotated via (1, 0, 0), but using this "wrong" axis, but i have no idea, why. Could somebody explain me, why object is rotated via (1,-1, 0), not (1, 0, 0) as requested in mathutils.Matrix.Rotation() function?

Post Reply