GridWallsCameraBoom

Extends: BGE.CameraBoom

A camera boom for grid walls (BGE.GridWallsMap): it pulls in by marching through the grid toward the camera, rather than raycasting colliders, so the walls need no colliders and cost no per-frame collision checks.

map = new BGE.GridWallsMap(rows, {cellSize: 192, wallHeight: 128, origin: corner, solid: {"#": "stone"}}) boom = new BGE.GridWallsCameraBoom(m.game, map, {probeRadius: 10, minDistance: 25})

Override isBlockedAt() to block on something besides the map's solid cells.

Properties

  • stepLength (float) — How far apart (world units) the march samples the line to the camera. Keep it well under
  • map (BGE.GridWallsMap)

Constructor

new GridWallsCameraBoom( game: BGE.Game, map: BGE.GridWallsMap, args?: roAssociativeArray, ): GridWallsCameraBoom

Parameters

  • game (BGE.Game)
  • map (BGE.GridWallsMap) — the walls that block the camera
  • args (roAssociativeArray, optional, default: "{}") — CameraBoom's fields, and stepLength

Instance Methods

unblockedDistance( lookAt: BGE.Math.Vector, direction: BGE.Math.Vector, wanted: float, ): float

protected

Parameters

  • lookAt (BGE.Math.Vector)
  • direction (BGE.Math.Vector)
  • wanted (float)

Returns

  • float

isBlockedAt(x: float, z: float): boolean

protected

Parameters

  • x (float)
  • z (float)

Returns

  • boolean

update( lookAt: BGE.Math.Vector, desiredPosition: BGE.Math.Vector, dt: float, ): BGE.Math.Vector

Inherited from BGE.CameraBoom#update

Overrides: BGE.CameraBoom#update

Works out this frame's camera position.

Parameters

  • lookAt (BGE.Math.Vector) — the point the camera looks at, e.g. the player's head
  • desiredPosition (BGE.Math.Vector) — where the camera would be with nothing in the way
  • dt (float) — seconds since last frame

Returns

  • BGE.Math.Vector — the camera position to use

getDistance(): float

Inherited from BGE.CameraBoom#getDistance

Overrides: BGE.CameraBoom#getDistance

Distance from the look-at point to the camera after the last update().

Returns

  • float

isBlocked(): boolean

Inherited from BGE.CameraBoom#isBlocked

Overrides: BGE.CameraBoom#isBlocked

Whether something was in the way at the last update().

Returns

  • boolean

isClose(): boolean

Inherited from BGE.CameraBoom#isClose

Overrides: BGE.CameraBoom#isClose

Whether the camera is within closeDistance of the look-at point.

Returns

  • boolean

reset(): void

Inherited from BGE.CameraBoom#reset

Overrides: BGE.CameraBoom#reset

Forgets the eased distance, so the next update() snaps straight to the result, e.g. after a cut or a respawn.

Returns

  • void

unblockedDistance( lookAt: BGE.Math.Vector, direction: BGE.Math.Vector, wanted: float, ): float

protected

Inherited from BGE.GridWallsCameraBoom#unblockedDistance

Overrides: BGE.CameraBoom#unblockedDistance

Parameters

  • lookAt (BGE.Math.Vector)
  • direction (BGE.Math.Vector)
  • wanted (float)

Returns

  • float

unblockedDistance( lookAt: BGE.Math.Vector, direction: BGE.Math.Vector, wanted: float, ): float

protected

Inherited from BGE.GridWallsCameraBoom#unblockedDistance

Overrides: BGE.CameraBoom#unblockedDistance

Parameters

  • lookAt (BGE.Math.Vector)
  • direction (BGE.Math.Vector)
  • wanted (float)

Returns

  • float