
localOrientation
- Get/set the object's local 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
Values:
- Cosine of 90 degrees is 0.00
- Cosine of 0 degrees is 1.00
World X-axis:
- angle to game object x-axis = 0 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 90 degrees
World Y-axis:
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 0 degrees
- angle to game object z-axis = 90 degrees
World Z-axis:
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 0 degrees
3x3 Matrix:
- [[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
Values:
- 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
World X-axis:
- angle to game object x-axis = 45 degrees
- angle to game object y-axis = 90 degrees
- angle to game objcet z-axis = 45 degrees
World Y-axis:
- angle to game object x-axis = 90 degrees
- angle to game object y-axis = 0 degrees
- angle to game object z-axis = 90 degrees
World Z-axis:
- angle to game object x-axis = 135 degrees
- angle to game object y-axis = 90 degrees
- angle to game object z-axis = 45 degrees
3x3 Matrix:
- [[0.7071, 0.0, 0.7071], [0.0, 1.0, 0.0], [-0.7071, 0.0, 0.7071]]
Note:
- Game object not parented:
- Local orientation is the orientation using the world axis as it's starting point
- Game object parented:
- Local orientation is the orientation using the parent's axis as it's starting point

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