
orientation
- Get/set the object's world orientation
- float list 3x3 matrix
- [ X-axis vector, Y-axis vector, Z-axis vector ]
- [ cosine of the angle of the world X-axis to the game object x-axis,
cosine of the angle of the world X-axis to the game object y-axis,
cosine of the angle of the world X-axis to the game object z-axis ]
- [ cosine of the angle of the world Y-axis to the game object x-axis,
cosine of the angle of the world Y-axis to the game object y-axis,
cosine of the angle of the world Y-axis to the game object z-axis ]
- [ cosine of the angle of the world Z-axis to the game object x-axis,
cosine of the angle of the world Z-axis to the game object y-axis,
cosine of the angle of the world Z-axis to the game object z-axis ]
Example:
- Game object axis orientation is the same as the world axis
- Cosine of 90 degrees is 0.00
- Cosine of 0 degrees is 1.00
- angle to game object x-axis = 0 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 90 degrees
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 0 degrees
- angle to game object z-axis = 90 degrees
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 0 degrees
- [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
- Game object is rotated 45 degrees on the game object y-axis
- Cosine of 90 degrees is 0.00
- Cosine of 0 degrees is 1.00
- Cosine of 45 degrees is 0.7071
- Cosine of 135 degrees is -0.7071
- angle to game object x-axis = 45 degrees
- angle to game object y-axis = 90 degrees
- angle to game objcet z-axis = 45 degrees
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 0 degrees
- angle to game object z-axis = 90 degrees
- angle to game object x-axis = 135 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 45 degrees
- [[0.7071, 0.0, 0.7071], [0.0, 1.0, 0.0], [-0.7071, 0.0, 0.7071]]

Sample Code
################## get the object's Orientation
# import bge
import bge
# get controller
cont = bge.logic.getCurrentController()
# get object that controller is attached to
obj = cont.owner
# get orientation
orient = obj.orientation
Sample Code
################## set the object's Orientation
# import bge
import bge
# get controller
cont = bge.logic.getCurrentController()
# get object that controller is attached to
obj = cont.owner
# set orientation to match world orientation
obj.orientation = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]