XrJoint
Since next
One joint of a tracked hand.
Signature
export interface XrJoint extends XrPose {
/** The same joint in the XR origin's frame. */
readonly local: XrPose
/** The joint's radius, metres. */
readonly radius: number
/** Its position and rotation were both tracked this tick. */
readonly valid: boolean
}
Import: import type { XrJoint } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
local | readonly local: XrPose | The same joint in the XR origin's frame. |
radius | readonly radius: number | The joint's radius, metres. |
valid | readonly valid: boolean | Its position and rotation were both tracked this tick. |
Example
The tested fixture fixtures/host/road-edges.ts.
// A behavior that keeps a car inside the road's wall: what `ctx.world.road(id).edge(s)` is for.
import type { Behavior } from "@argus/api"
export default {
update(ctx) {
const road = ctx.world.road("track")
if (road === null) return
const here = road.closest(ctx.entity.position)
const edge = road.edge(here.s)
// Keep the car's centre a radius inside the wall's inner face, or the kerb's edge when there is no wall.
const limit = (edge.barrier?.inner ?? edge.kerbOuter) - 0.8
const over: number = Math.abs(here.offset) - limit
const wallHeight: number | undefined = road.barrier?.heightM
const sides: "left" | "right" | "both" | undefined = road.barrier?.sides
const kerb: number = road.kerbWidth + road.kerbHeight
ctx.state.over = [over, wallHeight, sides, kerb, edge.halfWidth, edge.barrier?.left, edge.barrier?.right, edge.barrier?.outer, edge.barrier?.height]
},
} satisfies Behavior