Camera: getWorldToCamera

getWorldToCamera()
  • Returns the world to camera transform (which is the inverse matrix of the camera to world transform).

Return type: 
  • 4x4 matrix.
Sample Code

################## get the world to camera transform
  
# 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 transform
transform = cam.getWorldToCamera()