# InstanceRecord

> Talos next · Since 0.7

One instance of an instanced mesh, as {@link Instances.get} returns it.

## Signature

```ts
export interface InstanceRecord {
  /** The instance's stable id: never renumbered, never given to another instance. */
  readonly id: number
  /** In the instanced mesh's own frame (the world's, for one at the origin with no rotation). */
  readonly position: Vec3
  /** Quaternion `[x, y, z, w]`. */
  readonly rotation: [number, number, number, number]
  /** Uniform scale. */
  readonly scale: number
  /** The instance's custom floats, in the order the component's `customData` names them. */
  readonly custom: number[]
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `id` | `readonly id: number` | The instance's stable id: never renumbered, never given to another instance. |
| `position` | `readonly position: Vec3` | In the instanced mesh's own frame (the world's, for one at the origin with no rotation). |
| `rotation` | `readonly rotation: [number, number, number, number]` | Quaternion `[x, y, z, w]`. |
| `scale` | `readonly scale: number` | Uniform scale. |
| `custom` | `readonly custom: number[]` | The instance's custom floats, in the order the component's `customData` names them. |

## Example

The tested fixture `fixtures/recipes/jump-pad-and-elevator/scenes/behaviors/camera-zone.ts`.

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

/**
 * A trigger volume that retunes the camera while the player is inside it.
 *
 * The engine has no camera-zone concept and needs none: a volume, a `trigger` component and this.
 * Here the player's behaviour owns the camera (it re-sends its params when the view is turned), so
 * the zone tells it what to change rather than calling `ctx.camera.set` itself. In a scene where
 * nothing else writes the camera, the zone can call `ctx.camera.set(kind, params)` directly.
 */
interface Props {
  /** `ctx.camera.set` params to merge in on the way in, and on the way out. */
  inside?: Record<string, unknown>
  outside?: Record<string, unknown>
}

export default {
  onTrigger(ctx, trigger) {
    const params = trigger.entering ? ctx.props.inside : ctx.props.outside
    if (params) ctx.events.emit("camera-zone", { target: trigger.other.id, params })
  },
} satisfies Behavior<Record<string, never>, Props>
```
