Camera: ortho_scale

ortho_scale
  • gets/sets the camera's orthographic scale.

Type:
  • float number
Range:
  • 0.01 to 4000.00
Note:
  • Perspective View: The size of the game object on the screen depends on it's distance from the camera.  It gets smaller as the distance from the camera increases.
     
  • Orthographic View:  The size of the game object on the screen is always the same size.  It doesn't get smaller as it farther away from the camera.
Sample Code

################## get the camera's orthographic scale
  

# 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 the orthographic scale
scale = cam.ortho_scale

Sample Code

################## set the camera's orthographic scale

# 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 camera to orthographic view
cam.perspective = False

# set the orthographic scale
cam.ortho_scale = 2.5