Talos docs

XrPose

Since next

A pose in metres: a position and a unit quaternion [x, y, z, w].

Plain text

Signature

export interface XrPose {
  /** Where, metres. */
  readonly position: Vec3
  /** Which way, as a unit quaternion `[x, y, z, w]`. */
  readonly rotation: [number, number, number, number]
}

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

Members

MemberSignatureDescription
positionreadonly position: Vec3Where, metres.
rotationreadonly rotation: [number, number, number, number]Which way, as a unit quaternion [x, y, z, w].

Example

The tested fixture fixtures/host/door.ts.

import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
  update(ctx) {
    const player = ctx.world.find("player")
    const near = player !== null && ctx.entity.distanceTo(player) < 2
    ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
  },
} satisfies Behavior