Talos docs

WheelContact

Since 0.6

{@link Wheel.contact}: where the tyre touches the ground.

Plain text

Signature

export interface WheelContact {
  /** World space. */
  point: Vec3
  /** The ground's normal there, unit length. */
  normal: Vec3
  /** What it stands on. */
  entity: EntityHandle
}

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

Members

MemberSignatureDescription
pointpoint: Vec3World space.
normalnormal: Vec3The ground's normal there, unit length.
entityentity: EntityHandleWhat it stands on.

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