Talos docs

AuthorPlacement

Since 0.6

Where an entity goes, relative to its parent.

Plain text

Every field defaults (origin, no turn, unit scale).

Signature

export interface AuthorPlacement {
  /** A handle from this script, or the id of any entity of the scene. */
  parent?: AuthorHandle | string;
  /** Offset from the parent, in metres. */
  position?: AuthorVec3;
  /** A quaternion, `[x, y, z, w]`. */
  rotation?: [number, number, number, number];
  /** Size multiplier on each axis. */
  scale?: AuthorVec3;
  /** Instead of position, rotation and scale. */
  transform?: { position?: AuthorVec3; rotation?: [number, number, number, number]; scale?: AuthorVec3 };
  /** The label the editor shows; the key when absent. */
  name?: string;
}

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

Members

MemberSignatureDescription
parentparent?: AuthorHandle | stringA handle from this script, or the id of any entity of the scene.
positionposition?: AuthorVec3Offset from the parent, in metres.
rotationrotation?: [number, number, number, number]A quaternion, [x, y, z, w].
scalescale?: AuthorVec3Size multiplier on each axis.
transformtransform?: { position?: AuthorVec3; rotation?: [number, number, number, number]; scale?: AuthorVec3 }Instead of position, rotation and scale.
namename?: stringThe label the editor shows; the key when absent.

Example

The tested fixture fixtures/recipes/many-entities/scenes/behaviors/beacon.ts.

import type { Behavior } from "@argus/api"

/** A beacon: counts the drones that touch it. Only this beacon hears its touches (`emitTo`). */
interface State {
  touches: number
}

export default {
  init(ctx) {
    ctx.state.touches ??= 0
  },
  onEvent(ctx, ev) {
    if (ev.name === "touched") ctx.state.touches += 1
  },
} satisfies Behavior<State>