3 ms·
FYI, you can solve your problem in closed form by converting your Euler angles into the 'rotation vector'[1] or 'axis-angle'[2] representations and then normali
by oasisaimlessly 1y ago
FYI, you can solve your problem in closed form by converting your Euler angles into the 'rotation vector'[1] or 'axis-angle'[2] representations and then normalizing the resulting vector.
[1]: https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation#Rotation_vector https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representat...
[2]: https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representat...
- Etherlord87 1y agoCool! 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("--")