AuthorPlacement
Since 0.6
Where an entity goes, relative to its parent.
Every field defaults (origin, no turn, unit scale).
Signature
export interface AuthorPlacement {
/** A handle from this script, or the id of any entity of the scene. */
parent?: AuthorHandle | string;
/** Offset from the parent, in metres. */
position?: AuthorVec3;
/** A quaternion, `[x, y, z, w]`. */
rotation?: [number, number, number, number];
/** Size multiplier on each axis. */
scale?: AuthorVec3;
/** Instead of position, rotation and scale. */
transform?: { position?: AuthorVec3; rotation?: [number, number, number, number]; scale?: AuthorVec3 };
/** The label the editor shows; the key when absent. */
name?: string;
}
Import: import type { AuthorPlacement } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
parent | parent?: AuthorHandle | string | A handle from this script, or the id of any entity of the scene. |
position | position?: AuthorVec3 | Offset from the parent, in metres. |
rotation | rotation?: [number, number, number, number] | A quaternion, [x, y, z, w]. |
scale | scale?: AuthorVec3 | Size multiplier on each axis. |
transform | transform?: { position?: AuthorVec3; rotation?: [number, number, number, number]; scale?: AuthorVec3 } | Instead of position, rotation and scale. |
name | name?: string | The label the editor shows; the key when absent. |
Example
The tested fixture fixtures/recipes/many-entities/scenes/behaviors/beacon.ts.
import type { Behavior } from "@argus/api"
/** A beacon: counts the drones that touch it. Only this beacon hears its touches (`emitTo`). */
interface State {
touches: number
}
export default {
init(ctx) {
ctx.state.touches ??= 0
},
onEvent(ctx, ev) {
if (ev.name === "touched") ctx.state.touches += 1
},
} satisfies Behavior<State>