Talos docs

SharedSplit

Since 0.7

{@link ViewsHandle.shared}'s split options: when the shared camera splits into one view per target, and when it merges back.

Plain text

Absent or invalid numbers keep the default.

Signature

export interface SharedSplit {
  /**
   * How two targets split the window: `"auto"` (the default) is `"left-right"` in a window wider than
   * it is tall and `"top-bottom"` otherwise. Three targets always split as `"three"`, four as `"grid"`.
   */
  layout?: "auto" | "left-right" | "top-bottom"
  /**
   * Split once the targets' spread (the widest distance between two of them, metres) is beyond this.
   * Default: the spread at which the shared camera reaches `maxDistance` (at `maxFov`, if given).
   */
  beyond?: number
  /** Merge once the spread is back under this, metres. Default: three quarters of `beyond`; never above it. */
  back?: number
  /** Seconds of game time a split's or a merge's condition must hold, unbroken, before it happens. Default 0.5. */
  hold?: number
}

Import: import type { SharedSplit } from "@argus/api"

Members

MemberSignatureDescription
layoutlayout?: "auto" | "left-right" | "top-bottom"How two targets split the window: "auto" (the default) is "left-right" in a window wider than it is tall and "top-bottom" otherwise. Three targets always split as "three", four as "grid".
beyondbeyond?: numberSplit once the targets' spread (the widest distance between two of them, metres) is beyond this. Default: the spread at which the shared camera reaches maxDistance (at maxFov, if given).
backback?: numberMerge once the spread is back under this, metres. Default: three quarters of beyond; never above it.
holdhold?: numberSeconds of game time a split's or a merge's condition must hold, unbroken, before it happens. Default 0.5.

Example

The tested fixture fixtures/host/lifecycle.ts.

import type { Behavior } from "@argus/api"
// Logs every lifecycle callback with the arguments it received.
export default {
  init(ctx) { ctx.log("init", { props: ctx.props, entity: ctx.entity.id }) },
  update(ctx, dt) { ctx.log("update", { dt }) },
  dispose(ctx) { ctx.log("dispose") },
  onCollision(ctx, c) { ctx.log("onCollision", { other: c.other.id, impulse: c.impulse }) },
  onTrigger(ctx, tr) { ctx.log("onTrigger", { event: tr.event, other: tr.other.id, entering: tr.entering }) },
  onEvent(ctx, ev) { ctx.log("onEvent", { name: ev.name, data: ev.data, by: ev.by }) },
} satisfies Behavior