Camera

Properties

  • orientation (dynamic) — A vector pointed in the direction of the camera
  • position (BGE.Math.Vector)
  • motionChecker (MotionChecker)
  • frameSize (BGE.Math.Vector)
  • projectionVersion (integer) — Bumped whenever something about the camera's projection - as opposed to its
  • zoom (float)
  • drawDistanceScale (float) — Multiplier on a 3D camera's maxDrawDistance, set from the renderer's quality
  • drawDistanceOverride (float) — Absolute draw distance from the renderer's quality settings; 0 or less means
  • planeDrawDistanceScale (float) — How far a 3D camera's ground plane reaches, as a multiple of maxDrawDistance - the
  • planeDrawDistanceOverride (float) — The largest absolute draw distance any quality level uses (0 = none). Set by the
  • worldToCamera (Array.<Array.<float>>)
  • name (string)

Constructor

new Camera(): Camera

Instance Methods

setFrameSize(width: integer, height: integer): void

Parameters

  • width (integer)
  • height (integer)

Returns

  • void

bumpProjectionVersion(): void

Force a projection change to be reported this frame. Public so a future setter can declare a change explicitly rather than relying on the dirty check to spot it.

Returns

  • void

checkProjectionChange(): void

protected

Returns

  • void

projectionChangedThisFrame(): boolean

protected

Returns

  • boolean

onProjectionChange(): void

protected

Returns

  • void

setTarget(targetPos: BGE.Math.Vector): void

Points the camera at the target position Override in subclasses to implement different camera behaviors

Parameters

  • targetPos (BGE.Math.Vector)

Returns

  • void

useDefaultCameraTarget(): void

Returns

  • void

rotate( targetPos: BGE.Math.Vector, rotation: BGE.Math.Vector, ): void

Rotate the camera by the given rotation Override in subclasses to implement different camera behaviors

Parameters

  • targetPos (BGE.Math.Vector)
  • rotation (BGE.Math.Vector)

Returns

  • void

checkMovement(): void

Returns

  • void

onCameraMovement(): void

Returns

  • void

movedLastFrame(): boolean

Returns

  • boolean

distanceFromCameraFront(point: BGE.Math.Vector): float

Parameters

  • point (BGE.Math.Vector)

Returns

  • float

getDistanceFadeAlpha(point: BGE.Math.Vector): float

How visible a point is given the draw-distance fade band, from 1 (fully visible) to 0 (at or past the draw distance). Only a 3D camera has a draw distance, so this is always 1 here.

Parameters

  • point (BGE.Math.Vector) — world position

Returns

  • float

supportsOcclusionCulling(): boolean

Whether occluders (see Drawable.isOccluder) can hide objects with this camera. Only a Camera3d can: occlusion culling needs every point's depth in front of the camera.

Returns

  • boolean

fadesWithDistance(): boolean

Whether objects fade out toward a draw distance with this camera. Always false for a camera with no draw distance.

Returns

  • boolean

getDistanceFadeAlphaForPoints( points: Array.<BGE.Math.Vector>, ): float

How visible an object is given the draw-distance fade band, judged by whichever of its points is nearest. Always 1 for a camera with no draw distance.

Parameters

  • points (Array.<BGE.Math.Vector>) — the object's world-space bounding points

Returns

  • float

farDistanceChangedThisFrame(): boolean

Whether the draw distance or its fade band changed this frame, so every object's fade (and far-clip) needs checking again. Always false for a camera with no draw distance.

Returns

  • boolean

isDrawDistanceTransitioning(): boolean

Whether the draw distance is still easing toward a new value. Always false for a camera with no draw distance.

Returns

  • boolean

isInView(point: BGE.Math.Vector): boolean

Parameters

  • point (BGE.Math.Vector)

Returns

  • boolean

isAnyInView(points: Array.<BGE.Math.Vector>): boolean

Checks whether any part of a shape, given by its world-space corner/bounding points, could be visible. The default is true when at least one point is in view.

Parameters

  • points (Array.<BGE.Math.Vector>)

Returns

  • boolean

computeWorldToCameraMatrix(): void

Returns

  • void

getDrawMode(): BGE.SceneObjectDrawMode

Returns

worldPointToCanvasPoint( pWorld: BGE.Math.Vector, ): BGE.Math.Vector

Parameters

  • pWorld (BGE.Math.Vector)

Returns

  • BGE.Math.Vector

getUpVector(): BGE.Math.Vector

A normalized vector pointing up in the camera's own view. Together with getRightVector() this spans the plane the camera is looking at, which is what a camera-facing billboard is built in. A camera that can't rotate just uses world up.

Returns

  • BGE.Math.Vector

getRightVector(): BGE.Math.Vector

A normalized vector pointing right in the camera's own view - see getUpVector().

Returns

  • BGE.Math.Vector