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