Camera: orientation

orientation
  • gets/sets the object's local orientation.

Type:

  • 3x3 matrix
Sample Code

################## get the object's local Orientation
  
# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the cameras
camList = scene.cameras

# get camera
# my camera is named security_cam

cam = camList["security_cam"]

# get local orientation
orient_local = cam.orientation

Sample Code

################## set the object's local Orientation
    
# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get a list of the cameras
camList = scene.cameras

# get camera
# my camera is named security_cam

cam = camList["security_cam"]

# set local orientation to match world orientation
cam.orientation = ([1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0])