1
$\begingroup$

A bone was rotated 90 degrees on the Y axis.

I simply want to get (0, 90, 0), but in Blender it is represented by Euler angles (86.4, 44.9, 66.3).

How do I get rotation on the global axis In Python code?

enter image description here

import bpy
obj = bpy.data.objects["Armature"]
for pbone in obj.pose.bones:
    rotate_x = pbone.rotation_euler.x ##1.5072393417358398 (Euler)
    rotate_y = pbone.rotation_euler.y ##0.7828118801116943 (Euler)
    rotate_z = pbone.rotation_euler.z ##1.1571569442749023 (Euler)

    '''
    rotate_x _y _z are all euler angles of Bone.
    But I want to get these as below.
    It will be
    rotate_x = 0
    rotate_y = 1.5708(or 90)
    rotate_z = 0
    because rotate 90 degrees on Axis Y.
    '''
$\endgroup$
  • $\begingroup$ Possibly, Blender's bone may not be able to obtain the rotation angle on the global axis. I searched for a reference, but there was no code that could get the rotation angle on the global axis anywhere. $\endgroup$ – PERIPERI Apr 8 '19 at 3:20
  • $\begingroup$ For example, suppose you rotate 90 degrees on the global Y axis. (0, 90, 0) is the desired value. However, Blender always refers to the local rotation angle. Even if it rotates on the global axis, the value of the rotation angle is displayed as rotation on the local axis. $\endgroup$ – PERIPERI Apr 8 '19 at 3:26
  • $\begingroup$ If you want to add additional information to your question, please use the edit link below your question and don't add them to the comment section. $\endgroup$ – metaphor_set Apr 8 '19 at 13:56