# Game Object: orientation orientation
• Get/set the object's world orientation Type:
• float list 3x3 matrix
3x3 matrix:
• [ X-axis vector, Y-axis vector, Z-axis vector ] X-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 ]
Y-axis vector:
• [ 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 ]
Z-axis vector:
• [ 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]] Example:
• 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]] 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]]