AnimatorWarpOptions
Since 0.7
What {@link Animator.warp} aims the playing state's root motion at.
Signature
export interface AnimatorWarpOptions {
/** The world point to arrive at; only x and z are read. An entity handle is its position. */
to: Vec3 | EntityHandle
/** The clip time, in seconds of the clip as authored, at which the root is to be at `to`. At least 0. */
by: number
/** The most the clip's own travel may be stretched. Default 2.5; at least 0. */
maxScale?: number
}
Import: import type { AnimatorWarpOptions } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
to | to: Vec3 | EntityHandle | The world point to arrive at; only x and z are read. An entity handle is its position. |
by | by: number | The clip time, in seconds of the clip as authored, at which the root is to be at to. At least 0. |
maxScale | maxScale?: number | The most the clip's own travel may be stretched. Default 2.5; at least 0. |
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