Camera3d

Extends: Camera

Properties

  • fieldOfViewDegrees (float)
  • rollDegrees (float) — Rotation about the camera's own forward/view axis, in degrees. Positive = right
  • maxDrawDistance (float) — How far (world units) in front of the camera your game wants to draw. The
  • 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

Parameters

  • recomputeNormals (boolean)

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, ): Array.<BGE.Math.Vector>

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

  • Array.<BGE.Math.Vector> — 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): Array.<BGE.Math.Vector>

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

  • Array.<BGE.Math.Vector> — 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, ): Array.<BGE.Math.Vector>

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

  • Array.<BGE.Math.Vector>

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

  • BGE.Math.Vector

getRightVector(): BGE.Math.Vector

Returns

  • BGE.Math.Vector

getPlaneDrawDistance(): float

How far a DrawablePlane (ground/terrain) draws: maxDrawDistance capped for this device, ignoring the quality level, so the horizon stays put when the level changes.

Returns

  • float

getEffectiveMaxDrawDistance(): float

The draw distance the renderer actually uses: drawDistanceOverride if set, otherwise maxDrawDistance * drawDistanceScale, then capped for this device.

Returns

  • float

projectionChangedThisFrame(): boolean

protected

Returns

  • boolean

onProjectionChange(): void

protected

Returns

  • void