Talos docs

BonePose

Since 0.7

Where a bone is, as {@link Animator.bone} reports it.

Plain text

Signature

export interface BonePose {
  /** World position, metres. */
  position: Vec3
  /** World rotation, as a quaternion [x, y, z, w]. */
  rotation: [number, number, number, number]
}

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

Members

MemberSignatureDescription
positionposition: Vec3World position, metres.
rotationrotation: [number, number, number, number]World rotation, as a 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