Comment by Etherlord87
2 days ago
Cool! Thanks for that; it makes perfect sense: if you convert the rotation to axis-angle, and then take that axis, obviously a vector rotated around the axis defined by itself won't change.
I just tested it:
from bpy import context as C
from mathutils import Vector, Euler
from math import radians as rad
r = Euler((rad(5), rad(5), 0))
ob = C.object
ob.rotation_euler = r
ob.rotation_mode = 'AXIS_ANGLE'
a, x, y, z = ob.rotation_axis_angle
v = Vector((x, y, z))
print(v)
v.rotate(r)
print(v)
print("--")
Can be done without using an object:
from mathutils import Vector, Euler
from math import radians as rad
r = Euler((rad(5), rad(5), 0))
v = Vector(r.to_quaternion().axis)
print(v)
v.rotate(r)
print(v)
print("--")
No comments yet
Contribute on Hacker News ↗