Follow2DRig
Since 0.6
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
| Member | Signature | Description |
|---|---|---|
kind | readonly kind = "fixed" as const | |
inheritsFov | readonly inheritsFov = true | No fov of its own: an orthographic lens ignores it, and a perspective one keeps the scene camera's. |
config | readonly config: Follow2DConfig | |
pose | pose: CameraPose | |
yaw | readonly yaw = 0 | |
pitch | readonly pitch = 0 | |
constructor | constructor(config: Partial<Follow2DConfig> = {}) | |
followTarget | followTarget(ctx: Ctx): EntityHandle | null | |
center | get center(): Vec2 | The view centre as of the last update, XY. |
leadOffset | get leadOffset(): Vec2 | The look-ahead offset in force, XY. |
pixelLens | get pixelLens(): IntegerLens | null | The whole-number lens pixelScale chose on the last update, or null. |
viewHalfSize | viewHalfSize(ctx: Ctx): Vec2 | null | Half the view's width and height, world units: the pixelScale lens when there is one, else ctx.camera.viewSize; null for a perspective lens. |
boundsRect | boundsRect(ctx: Ctx): Rect2 | null | The rectangle the view stays inside this tick, or null. |
update | update(ctx: Ctx, dt: number, _input: RigInput): CameraPose | |
engineParams | engineParams(): 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. |