Camera3d

Extends: Camera

Properties

  • fieldOfViewDegrees (float)
  • rollDegrees (float) — Rotation about the camera's own forward/view axis, in degrees. Positive = right ' side down (aviation convention). getUpVector()/getRightVector() apply this on ' top of the "level" vectors - see getLevelUpVector()/getLevelRightVector().
  • frustumNormals (CameraFrustumNormals)
  • frustrumConvergence (BGE.Math.Vector)
  • frustumRays (CameraFrustumRays)
  • name (string)

Constructor

new Camera3d(): Camera3d

Instance Methods

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

Parameters

  • targetPos (BGE.Math.Vector)

Returns

  • void

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

Parameters

  • rotation (BGE.Math.Vector)

Returns

  • void

checkMovement(): void

Returns

  • void

onCameraMovement(): void

Returns

  • void

recomputeFrustum(recomputeNormals: boolean): void

protected

Rebuild the frustum from the camera's current position, orientation and field of view.

Parameters

  • recomputeNormals (boolean) — whether the frustum plane normals need rebuilding too

Returns

  • void

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

Parameters

  • point (BGE.Math.Vector)

Returns

  • float

distanceFromFrustumSide( frustumSide: string, point: BGE.Math.Vector, ): float

Parameters

  • frustumSide (string)
  • 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

toggleWireFrame(): void

Returns

  • void

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

Parameters

  • pWorld (BGE.Math.Vector)

Returns

  • BGE.Math.Vector

useDefaultCameraTarget(): void

Returns

  • void

getHorizonOfPlane_AI(plane: BGE.Math.Plane): dynamic

Returns two screen-space points that define the visible horizon line of a plane. If the horizon does not intersect the camera frame, an empty array is returned.

Parameters

  • plane (BGE.Math.Plane)

Returns

  • dynamic — Two points in screen space that define the horizon line of the plane, or an empty array if the plane is not visible.

findHorizonPoint( screenX: float, focalLength: float, nv: BGE.Math.Vector, ): BGE.Math.Vector

Parameters

  • screenX (float)
  • focalLength (float)
  • nv (BGE.Math.Vector)

Returns

  • BGE.Math.Vector

getFocalLength(): float

The camera's intrinsic focal length in pixels, derived from its real field of view and frame width. This is independent of any particular canvas size - see getFovDegreesForCanvasSize(), which uses it to answer "what FOV would a differently-sized canvas need to cover the same angular extent this camera actually sees."

Returns

  • float

getFovDegreesForCanvasSize(canvasSize: float): float

The (horizontal = vertical, meant for a square canvas) field of view a canvasSize x canvasSize canvas would need to cover the same angular extent as this camera's real field of view does for its own frame width, at the same focal length. Used by SceneObjectPlane to render its ground geometry into an enlarged canvas before rotating it for roll - see SceneObjectPlane.

Parameters

  • canvasSize (float)

Returns

  • float — degrees

getHorizonLine(plane: BGE.Math.Plane): dynamic

Returns two screen-space points that define the visible horizon line of a plane. If the horizon does not intersect the camera frame, invalid is returned.

Parameters

  • plane (BGE.Math.Plane)

Returns

  • dynamic — Two points in screen space that define the horizon line of the plane, or invalid if the plane is not visible.

getLevelHorizonLine( plane: BGE.Math.Plane, canvasSize: float, ): dynamic

The horizon line as seen by an unrolled (rollDegrees = 0) camera at this camera's real position/orientation, against a canvasSize x canvasSize square canvas rather than the real frame - useful for a Mode-7-style renderer that needs a plane's horizon position in an enlarged, unrolled view before applying roll as a final image rotation. Not currently called anywhere in this engine (SceneObjectPlane computes each ground slice's own position via true perspective projection instead, and no longer needs an explicit horizon position) - kept as public Camera3d API.

Parameters

  • plane (BGE.Math.Plane)
  • canvasSize (float)

Returns

  • dynamic

cameraPointToScreenPoint( pCamera: BGE.Math.Vector, ): BGE.Math.Vector

Converts from float (-1 to 1) screen space with (0,0) as the center of the screen to pixel coordinates

Parameters

  • pCamera (BGE.Math.Vector)

Returns

  • BGE.Math.Vector

getVerticalFOV(): float

Returns

  • float

getLevelUpVector(): BGE.Math.Vector

The "level" (rollDegrees = 0) up vector - see getUpVector() for the roll-aware version most callers want. SceneObjectPlane uses this one directly, since its ground rendering computes its own geometry against an unrolled view and applies roll as a final image rotation instead (see SceneObjectPlane).

Returns

  • BGE.Math.Vector

getLevelRightVector(): BGE.Math.Vector

The "level" (rollDegrees = 0) right vector - see getLevelUpVector().

Returns

  • BGE.Math.Vector

getUpVector(): BGE.Math.Vector

Returns a normalized up vector that is perpendicular to the camera orientation, rotated around the forward axis by rollDegrees. This assumes a world-up preference (+Y) before roll is applied, with fallback when forward is parallel to +Y - see getLevelUpVector().

Returns

  • BGE.Math.Vector

getRightVector(): BGE.Math.Vector

Returns

  • BGE.Math.Vector

projectionChangedThisFrame(): boolean

protected

Returns

  • boolean

onProjectionChange(): void

protected

Returns

  • void