FollowCamera

A camera rig that moves a Camera3d to follow a target entity: BGE.OrbitCamera and BGE.ChaseCamera. Type a field as this to swap rigs without changing the scene's code:

m.rig = new BGE.ChaseCamera(camera, m.player, {heading: m.rig.heading}) m.rig.follow(dt, {look: look, heading: heading, pitch: pitch, bank: bank})

Properties

  • camera (BGE.Camera3d)
  • target (BGE.GameEntity)
  • heading (float) — Ground heading the camera looks along (0 faces -z, increasing turns clockwise seen from above)

Instance Methods

follow(dt: float, input: BGE.FollowCameraInput): void

Moves the camera for this frame. Call it after everything has moved, e.g. in onPostUpdate().

Parameters

  • dt (float) — seconds since last frame
  • input (BGE.FollowCameraInput) — each camera reads the fields it uses

Returns

  • void

snapBehind(heading: float): void

Puts the camera straight behind the target, looking along heading, with no easing, e.g. after a respawn or when switching to this camera.

Parameters

  • heading (float) — radians

Returns

  • void

getLookAt(): BGE.Math.Vector

The point on the target the camera is framed round.

Returns

  • BGE.Math.Vector