Camera
Properties
orientation(dynamic) — A vector pointed in the direction of the cameraposition(BGE.Math.Vector)motionChecker(MotionChecker)frameSize(BGE.Math.Vector)projectionVersion(integer) — Bumped whenever something about the camera's projection - as opposed to its ' position or orientation - changes. MotionChecker watches only position and ' orientation, so without this a frame-size or field-of-view change is invisible to ' every dirty check in the renderer, and a stationary culled object stays culled ' through a projection change that should have brought it back into view.zoom(float) — TODO: do something with zoom!worldToCamera(dynamic)name(string)
Constructor
new Camera(): CameraInstance 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
Detect and act on a projection change. Called once per frame from checkMovement().
Returns
void
projectionChangedThisFrame(): boolean
Whether anything feeding the projection changed since the last frame, recording the new values as it goes. Override in a subclass to add its own terms - and call super.projectionChangedThisFrame() unconditionally, never inside a boolean expression, so its recording side effect always runs.
Returns
boolean— true if the projection changed
onProjectionChange(): void
Rebuild whatever the camera derives from its projection. Renderer only rebuilds the world-to-camera matrix when the camera moved, and Camera2d's isInView bounds (top/bottom/left/right) are computed inside that matrix build - so a frame-size change with a stationary camera would otherwise leave them stale.
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
isInView(point: BGE.Math.Vector): boolean
Parameters
point(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