Talos docs

Follow2DConfig

Since 0.6Changed in 0.7
Plain text

Signature

export interface Follow2DConfig {
  /** What the view follows: an entity, an entity id, or null for the behavior's entity. A point pins it. */
  target: CameraTarget
  /** Added to the target's position, units: `[0, 1]` frames a character's body rather than its feet. */
  offset: Vec2
  /** `[width, height]` of the box around the view centre the target moves in without moving the view. */
  deadzone: Vec2
  /** `[x, y]` units the view leads by in the direction the target is travelling; 0 on an axis is off. */
  lookAhead: Vec2
  /** Units per second below which the target counts as standing: the lead keeps its last direction. */
  lookAheadMinSpeed: number
  /** Smoothing rate for the lead turning round; higher is snappier, 0 is instant. */
  lookAheadLambda: number
  /** Smoothing rate for the view centre; higher is tighter, 0 is rigid. */
  followLambda: number
  /** What the view stays inside: a rectangle, a `tilemap` entity (or its id), or null for no limit. */
  bounds: Rect2 | EntityHandle | string | null
  /** The camera's Z; it looks down -Z at the XY plane. */
  z: number
  /** Frame a box at least `minHeight` units high, drawn at a whole-number pixel scale; null leaves the lens alone. */
  pixelScale: PixelScaleConfig | null
}

Import: import type { Follow2DConfig } from "@argus/gameplay"

Members

MemberSignatureDescription
targettarget: CameraTargetWhat the view follows: an entity, an entity id, or null for the behavior's entity. A point pins it.
offsetoffset: Vec2Added to the target's position, units: [0, 1] frames a character's body rather than its feet.
deadzonedeadzone: Vec2[width, height] of the box around the view centre the target moves in without moving the view.
lookAheadlookAhead: Vec2[x, y] units the view leads by in the direction the target is travelling; 0 on an axis is off.
lookAheadMinSpeedlookAheadMinSpeed: numberUnits per second below which the target counts as standing: the lead keeps its last direction.
lookAheadLambdalookAheadLambda: numberSmoothing rate for the lead turning round; higher is snappier, 0 is instant.
followLambdafollowLambda: numberSmoothing rate for the view centre; higher is tighter, 0 is rigid.
boundsbounds: Rect2 | EntityHandle | string | nullWhat the view stays inside: a rectangle, a tilemap entity (or its id), or null for no limit.
zz: numberThe camera's Z; it looks down -Z at the XY plane.
pixelScalepixelScale: PixelScaleConfig | nullFrame a box at least minHeight units high, drawn at a whole-number pixel scale; null leaves the lens alone.