Talos docs

Ray

Since 0.7

A world ray: dir is unit length.

Plain text

Signature

export interface Ray {
  /** Where the ray starts: on the view's near plane, world space. */
  readonly origin: Vec3
  /** Which way it goes: a unit vector, world space. */
  readonly dir: Vec3
}

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

Members

MemberSignatureDescription
originreadonly origin: Vec3Where the ray starts: on the view's near plane, world space.
dirreadonly dir: Vec3Which way it goes: a unit vector, world space.

Example

The tested fixture fixtures/app/agent.ts.

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

// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
  init(ctx) {
    ctx.state.arrived = false
    ctx.nav?.goTo(ctx.props.target as [number, number, number])
  },
  update(ctx) {
    if (ctx.nav?.arrived) ctx.state.arrived = true
  },
} satisfies Behavior