The type of owner.worldOrientation is an orientation matrix, which is basically a 3x3 list, with the first row being a point that the X axis is pointing to, the second row a point that the Y axis is pointing to, and the third being the point that the Z axis is pointing to. Each row has 3 values which represent X, Y, and Z coordinates.
This matrix is called the “identity” matrix, but you can think of it just as the normal, nothing-is-rotated-or-scaled matrix.
[[1,0,0] #x axis points at the point (1,0,0)
[0,1,0] #y axis points at the point (0,1,0)
[0,0,1]] #z axis points at the point (0,0,1)
Thanks to a useful utility called Mathutils, you can easily find rotation in degrees, if that’s what you’re after.
import GameLogic as g
from Mathutils import *
c = GameLogic.getCurrentController()
ori = c.owner.worldOrientation
ori = Matrix(ori,ori,ori)
eul = ori.toEuler()
c.owner['zRot'] = eul
This script puts the Z rotation (in Degrees) into a variable called “zRot”. eul would, similarly, get the X rotation.
Attached is an example blend… use the Z key to rotate the object.
Hope that helps!
eulerRotation.blend (33.6 KB)