Talos docs

Follow2DRig

Since 0.6
Plain text

Signature

export class Follow2DRig implements CameraRig {
  readonly kind = "fixed" as const
  readonly inheritsFov = true
  readonly config: Follow2DConfig
  pose: CameraPose
  readonly yaw = 0
  readonly pitch = 0
  constructor(config: Partial<Follow2DConfig> = {})
  followTarget(ctx: Ctx): EntityHandle | null
  get center(): Vec2
  get leadOffset(): Vec2
  get pixelLens(): IntegerLens | null
  viewHalfSize(ctx: Ctx): Vec2 | null
  boundsRect(ctx: Ctx): Rect2 | null
  update(ctx: Ctx, dt: number, _input: RigInput): CameraPose
  engineParams(): Record<string, unknown>
}

Import: import { Follow2DRig } from "@argus/gameplay"

Members

MemberSignatureDescription
kindreadonly kind = "fixed" as const
inheritsFovreadonly inheritsFov = trueNo fov of its own: an orthographic lens ignores it, and a perspective one keeps the scene camera's.
configreadonly config: Follow2DConfig
posepose: CameraPose
yawreadonly yaw = 0
pitchreadonly pitch = 0
constructorconstructor(config: Partial<Follow2DConfig> = {})
followTargetfollowTarget(ctx: Ctx): EntityHandle | null
centerget center(): Vec2The view centre as of the last update, XY.
leadOffsetget leadOffset(): Vec2The look-ahead offset in force, XY.
pixelLensget pixelLens(): IntegerLens | nullThe whole-number lens pixelScale chose on the last update, or null.
viewHalfSizeviewHalfSize(ctx: Ctx): Vec2 | nullHalf the view's width and height, world units: the pixelScale lens when there is one, else ctx.camera.viewSize; null for a perspective lens.
boundsRectboundsRect(ctx: Ctx): Rect2 | nullThe rectangle the view stays inside this tick, or null.
updateupdate(ctx: Ctx, dt: number, _input: RigInput): CameraPose
engineParamsengineParams(): Record<string, unknown>The pixelScale lens as ctx.camera.set params: the box's orthoSize, and pixelsPerUnit as the art's texels a unit, so the engine picks the whole-number scale it is drawn at in the window. Nothing without one.