@realitycollective/webxr-interactions 0.1.1-preview.3 → 0.1.2-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -2
- package/README.md +16 -2
- package/dist/behaviours/behaviour.d.ts +17 -1
- package/dist/behaviours/behaviour.js +12 -2
- package/dist/behaviours/behaviour.js.map +1 -1
- package/dist/behaviours/grab.d.ts +1 -0
- package/dist/behaviours/grab.js +10 -4
- package/dist/behaviours/grab.js.map +1 -1
- package/dist/contract-cases.js +15 -0
- package/dist/contract-cases.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/math.d.ts +8 -0
- package/dist/math.js +17 -0
- package/dist/math.js.map +1 -1
- package/dist/memory-ports.d.ts +55 -0
- package/dist/memory-ports.js +128 -0
- package/dist/memory-ports.js.map +1 -0
- package/dist/near-pointer-contract-cases.js +48 -0
- package/dist/near-pointer-contract-cases.js.map +1 -1
- package/dist/near-pointer.d.ts +9 -52
- package/dist/near-pointer.js +9 -23
- package/dist/near-pointer.js.map +1 -1
- package/dist/release-velocity.d.ts +58 -0
- package/dist/release-velocity.js +89 -0
- package/dist/release-velocity.js.map +1 -0
- package/dist/runtime.d.ts +38 -2
- package/dist/runtime.js +75 -15
- package/dist/runtime.js.map +1 -1
- package/dist/trace-synthetic.d.ts +12 -0
- package/dist/trace-synthetic.js +194 -0
- package/dist/trace-synthetic.js.map +1 -0
- package/dist/trace.d.ts +215 -0
- package/dist/trace.js +350 -0
- package/dist/trace.js.map +1 -0
- package/package.json +8 -4
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,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AAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACrD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAEO,cAAc;QACpB,KAAK,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AAED,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAChC,OAA2B,EAC3B,UAAuD,EACvD,WAA0C,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IAEpD,KAAK,MAAM,YAAY,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;QACpD,OAAO,CAAC,oBAAoB,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC","sourcesContent":["/**\n * InteractionRuntime - the engine-free orchestrator.\n *\n * Once per host frame the runtime pulls the input provider, resolves\n * targeting (provider hints first - provider power wins - then poke\n * proximity, then ray hits), applies press/grab transitions with\n * hysteresis, runs gaze gating + dwell, ticks every behaviour, and emits\n * interaction events and feedback intents. It never touches an engine:\n * space queries and transform writes go through the adapter-implemented\n * {@link HitTester} and {@link TransformPort}.\n *\n * Lifecycle is first-class (the pale-signal gap): interactables register,\n * unregister, enable and disable; behaviours disabled by capability\n * negotiation announce themselves with a `behaviourDisabled` event.\n */\nimport {\n SELECT_PRESS_THRESHOLD,\n SELECT_RELEASE_THRESHOLD,\n rayPoseFromRay,\n resolveEyeGazeOptions,\n unmetRequirements,\n type EyeGazeOptions,\n type InputCapabilities,\n type InputHitHint,\n type InputProvider,\n type InputSourceSnapshot,\n type PoseTuple,\n type QuatTuple,\n type RayTuple,\n type Unsubscribe,\n type Vec3Tuple,\n} from \"@realitycollective/webxr-input\";\nimport type { Behaviour, InteractorInfo } from \"./behaviours/behaviour.js\";\nimport {\n createBehaviour,\n type BehaviourConfig,\n type BehaviourFactoryContext,\n} from \"./behaviours/factory.js\";\nimport { GrabBehaviour } from \"./behaviours/grab.js\";\nimport type { InteractableDescriptor } from \"./descriptor.js\";\nimport { Emitter, type InteractionEvent, type InteractionEventListener } from \"./events.js\";\nimport type { FeedbackIntent, FeedbackListener } from \"./feedback.js\";\nimport { DwellState, GazeConsensus, resolveDwellConfig, DWELL_DEFAULTS, type DwellConfig } from \"./gaze.js\";\nimport { quatConjugate, quatMultiply, vApplyQuat, vLength, vNormalize, vSub } from \"./math.js\";\nimport type { HitTester, InteractableHit, TransformPort } from \"./ports.js\";\nimport {\n pickActivePointer,\n pointerVisualsFor,\n resolveNearPointerOptions,\n TouchPointerState,\n type ActivePointerKind,\n type NearPointerOptions,\n type PointerCandidate,\n type PointerVisuals,\n} from \"./near-pointer.js\";\nimport { VelocityTracker, type VelocityTrackerOptions } from \"./velocity-tracker.js\";\n/** Interactor id used when gaze is synthesized from the head pose. */\nexport const HEAD_GAZE_INTERACTOR_ID = \"head-gaze\";\n\nexport interface InteractableState {\n id: string;\n enabled: boolean;\n hovered: boolean;\n gazeHovered: boolean;\n pressed: boolean;\n grabbed: boolean;\n /** Primary behaviour's logical value. */\n value: number;\n /** Gaze-dwell meter 0..1 (0 when dwell is not enabled). */\n dwell: number;\n}\n\ninterface BehaviourSlot {\n instance: Behaviour;\n config: BehaviourConfig;\n disabled: boolean;\n disabledReason: string;\n}\n\ninterface Registered {\n def: InteractableDescriptor;\n behaviours: BehaviourSlot[];\n transform: TransformPort | undefined;\n enabled: boolean;\n /** The touch hover ENTER distance for this target (`InteractableDescriptor.pokeRadius`, else the near-pointer default). */\n pokeRadius: number;\n gazeRequired: boolean;\n dwellConfig: Required<DwellConfig> | null;\n dwell: DwellState;\n gazeHovered: boolean;\n hoveredBy: Set<string>;\n pressedBy: Set<string>;\n grabbedBy: string | null;\n}\n\n/** How a source's target was found this frame; `\"poke\"` and `\"grab\"` mark a near pointer, which suppresses eye gaze. */\ntype ResolvedBy = \"hint\" | \"poke\" | \"grab\" | \"ray\" | \"gaze\" | null;\n\ninterface SourceRuntimeState {\n hoverTarget: string | null;\n resolvedBy: ResolvedBy;\n pressed: boolean;\n pressTarget: string | null;\n grabbed: boolean;\n grabTarget: string | null;\n /** The pointer owning this source this frame (`near-pointer.ts`). */\n active: ActivePointerKind | null;\n /** The active pointer's candidate, where the cursor sits. */\n candidate: PointerCandidate | null;\n /** The touch pointer's hover and press machine. */\n touch: TouchPointerState;\n}\n\n/** A gaze selection in progress: the pointer the pinching hand took over (see `followHand`). */\ninterface GazeHold {\n sourceId: string;\n /** The gaze ray at the moment of selection, used while the hand cannot follow. */\n ray: RayTuple;\n /** The aimed ray's orientation relative to the hand's ray space, or null when the pointer stays put. */\n relative: QuatTuple | null;\n}\n\nexport interface InteractionRuntimeOptions {\n provider: InputProvider;\n hitTester?: HitTester;\n dwellDefaults?: DwellConfig;\n /**\n * Eye-gaze targeting, when the provider reports `capabilities.eyeGaze`:\n * the selection cone, dwell window, near-pointer suppression and whether a\n * gaze-started drag follows the pinching hand. Defaults are IWSDK 1.0.0's\n * (`EYE_GAZE_DEFAULTS`).\n */\n eyeGaze?: EyeGazeOptions;\n /**\n * Per-source velocity tracking. On by default with no smoothing; pass\n * `false` to skip it, or options to smooth. The tracker only fills in\n * what the provider did not supply.\n */\n velocity?: VelocityTrackerOptions | false;\n /**\n * The near-pointer rule's distances: touch hover enter and exit, touch\n * press, grip grab radius. Defaults are IWSDK 1.0.0's\n * (`NEAR_POINTER_DEFAULTS`). An interactable's own `pokeRadius` overrides\n * the touch hover enter distance for that target alone.\n */\n nearPointer?: Partial<NearPointerOptions>;\n}\n\nexport interface RegisterPorts {\n transform?: TransformPort;\n}\n\nexport class InteractionRuntime {\n private readonly provider: InputProvider;\n private hitTester: HitTester | null;\n private readonly dwellDefaults: Required<DwellConfig>;\n\n private readonly interactables = new Map<string, Registered>();\n private readonly sourceStates = new Map<string, SourceRuntimeState>();\n private readonly events = new Emitter<InteractionEvent>();\n private readonly feedbackEmitter = new Emitter<FeedbackIntent>();\n private readonly afterSample = new Emitter<readonly InputSourceSnapshot[]>();\n private readonly visualsEmitter = new Emitter<readonly PointerVisuals[]>();\n private readonly nearPointer: NearPointerOptions;\n private lastVisuals: PointerVisuals[] = [];\n private readonly velocityTracker: VelocityTracker | null;\n private lastSources = new Map<string, InputSourceSnapshot>();\n private capabilities: InputCapabilities;\n private readonly unsubscribeCaps: Unsubscribe;\n private disposed = false;\n private readonly eyeGaze: Required<EyeGazeOptions>;\n private readonly gazeConsensus: GazeConsensus;\n /** The eye-gaze source's target this frame: cone, consensus and suppression applied. */\n private eyeGazeTarget: string | null = null;\n /** Where the eye-gaze ray last aimed at each target, for the pinching hand to aim at. */\n private readonly gazePoints = new Map<string, Vec3Tuple>();\n private gazeHold: GazeHold | null = null;\n\n constructor(options: InteractionRuntimeOptions) {\n this.provider = options.provider;\n this.hitTester = options.hitTester ?? null;\n this.nearPointer = resolveNearPointerOptions(options.nearPointer);\n this.eyeGaze = resolveEyeGazeOptions(options.eyeGaze);\n this.gazeConsensus = new GazeConsensus(this.eyeGaze.dwellWindowSeconds);\n const d = options.dwellDefaults;\n this.dwellDefaults = {\n holdSeconds: d?.holdSeconds ?? DWELL_DEFAULTS.holdSeconds,\n decayFactor: d?.decayFactor ?? DWELL_DEFAULTS.decayFactor,\n rearmBelow: d?.rearmBelow ?? DWELL_DEFAULTS.rearmBelow,\n };\n this.velocityTracker =\n options.velocity === false ? null : new VelocityTracker(options.velocity ?? {});\n this.capabilities = this.provider.getCapabilities();\n this.unsubscribeCaps = this.provider.onCapabilitiesChanged((caps) => {\n this.capabilities = caps;\n this.renegotiateAll();\n });\n }\n\n // -- registry -------------------------------------------------------------\n\n registerInteractable(def: InteractableDescriptor, ports: RegisterPorts = {}): void {\n if (this.interactables.has(def.id)) {\n throw new Error(`Interactable \"${def.id}\" is already registered`);\n }\n const context: BehaviourFactoryContext = {\n grabFulfilment: this.capabilities.grabs === \"native\" ? \"native\" : \"poseOnly\",\n };\n const registered: Registered = {\n def,\n behaviours: def.behaviours.map((config) => ({\n instance: createBehaviour(config, context),\n config,\n disabled: false,\n disabledReason: \"\",\n })),\n transform: ports.transform,\n enabled: def.enabled !== false,\n pokeRadius: def.pokeRadius ?? this.nearPointer.touchHoverEnter,\n gazeRequired: def.gaze?.required === true,\n dwellConfig: resolveDwellConfig(def.gaze?.dwell, this.dwellDefaults),\n dwell: new DwellState(),\n gazeHovered: false,\n hoveredBy: new Set(),\n pressedBy: new Set(),\n grabbedBy: null,\n };\n this.interactables.set(def.id, registered);\n this.renegotiate(def.id, registered);\n }\n\n unregisterInteractable(id: string): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n this.releaseAllHolds(id);\n this.interactables.delete(id);\n }\n\n setInteractableEnabled(id: string, enabled: boolean): void {\n const registered = this.interactables.get(id);\n if (!registered || registered.enabled === enabled) return;\n registered.enabled = enabled;\n if (!enabled) this.releaseAllHolds(id);\n this.events.emit({\n type: enabled ? \"interactableEnabled\" : \"interactableDisabled\",\n interactableId: id,\n });\n }\n\n setHitTester(hitTester: HitTester | null): void {\n this.hitTester = hitTester;\n }\n\n /** Reach a live behaviour instance for tuning (playground steppers). */\n getBehaviour<T extends Behaviour = Behaviour>(interactableId: string, kind: string): T | undefined {\n const registered = this.interactables.get(interactableId);\n return registered?.behaviours.find((b) => b.instance.kind === kind)?.instance as T | undefined;\n }\n\n getState(id: string): InteractableState | undefined {\n const r = this.interactables.get(id);\n if (!r) return undefined;\n const primary = r.behaviours.find((b) => !b.disabled)?.instance;\n return {\n id,\n enabled: r.enabled,\n hovered: r.hoveredBy.size > 0 || r.gazeHovered,\n gazeHovered: r.gazeHovered,\n pressed: r.pressedBy.size > 0,\n grabbed: r.grabbedBy !== null,\n value: primary?.getValue() ?? 0,\n dwell: r.dwell.getProgress(),\n };\n }\n\n getInteractableIds(): string[] {\n return [...this.interactables.keys()];\n }\n\n // -- subscriptions ----------------------------------------------------------\n\n onEvent(listener: InteractionEventListener): Unsubscribe {\n return this.events.subscribe(listener);\n }\n\n onFeedback(listener: FeedbackListener): Unsubscribe {\n return this.feedbackEmitter.subscribe(listener);\n }\n\n /**\n * Sampled sources for this frame - the UI Extensions pointer bridge hook.\n *\n * @deprecated Use {@link onSample}. Both deliver the same stream: since\n * `@realitycollective/webxr-input` 0.1.1 carries `linearVelocity` and\n * `angularVelocity` on `InputSourceSnapshot`, the two signatures are\n * identical and only one name is needed. This one is kept so existing\n * callers keep working and will be removed in a later major release.\n */\n onSourcesSampled(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe {\n return this.afterSample.subscribe(listener);\n }\n\n /**\n * This frame's sources, velocity included.\n *\n * The snapshots are the provider's own objects for this frame and are\n * never written to again once delivered (the ownership rule on\n * `InputSourceSnapshot`), so a listener may keep one, or a tuple inside\n * it, across frames without copying.\n */\n onSample(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe {\n return this.afterSample.subscribe(listener);\n }\n\n /**\n * The last sample of one source, velocity included. Undefined before the\n * first update, and once the source stops reporting.\n *\n * The snapshot is the caller's to keep: it is never mutated after the\n * frame it was sampled in, and it is not refreshed in place, so call\n * again for a newer one.\n */\n getSource(id: string): InputSourceSnapshot | undefined {\n return this.lastSources.get(id);\n }\n\n getCapabilities(): InputCapabilities {\n return this.capabilities;\n }\n\n getProvider(): InputProvider {\n return this.provider;\n }\n\n /** The near-pointer distances in force (the defaults, or the options given). */\n getNearPointerOptions(): Readonly<NearPointerOptions> {\n return this.nearPointer;\n }\n\n /**\n * The pointer that owns a source this frame: `\"touch\"`, `\"grab\"`, `\"ray\"`\n * or `\"gaze\"`, or null when no pointer has a candidate (or the source is\n * unknown). Decided by the core rule in `near-pointer.ts`, on every\n * platform; a provider hint names the target but never the pointer.\n */\n getActivePointer(sourceId: string): ActivePointerKind | null {\n return this.sourceStates.get(sourceId)?.active ?? null;\n }\n\n /**\n * What to draw for every source this frame: the ray only while the ray is\n * the active pointer or nothing is, the cursor at the active pointer's\n * candidate. Published once per `update`, after the sources; a binding\n * applies it to its ray and cursor visuals, and a native binding hands it\n * to the host as `applyPointerVisuals`. The list and its entries are fresh\n * each frame and never written to again.\n */\n onPointerVisuals(listener: (visuals: readonly PointerVisuals[]) => void): Unsubscribe {\n return this.visualsEmitter.subscribe(listener);\n }\n\n /** The visuals last published for a source, or undefined before its first frame. */\n getPointerVisuals(sourceId: string): PointerVisuals | undefined {\n return this.lastVisuals.find((visuals) => visuals.sourceId === sourceId);\n }\n\n // -- frame ------------------------------------------------------------------\n\n update(dt: number): void {\n if (this.disposed) return;\n const sampled = this.provider.sample();\n const tracked = this.velocityTracker ? this.velocityTracker.update(sampled, dt) : sampled;\n const sources = this.followHand(tracked);\n const hints = this.provider.sampleHints?.() ?? [];\n this.lastSources = new Map(sources.map((source) => [source.id, source]));\n this.afterSample.emit(sources);\n\n const hintBySource = new Map<string, InputHitHint[]>();\n for (const hint of hints) {\n const list = hintBySource.get(hint.sourceId);\n if (list) list.push(hint);\n else hintBySource.set(hint.sourceId, [hint]);\n }\n\n // With eye gaze live, the hands and controllers go first: whether one of\n // them has a near pointer active this frame decides what gaze may target\n // (IWSDK reads the hand pointers' state before it drives the gaze pointer).\n const eyeGazeLive = this.capabilities.eyeGaze;\n const ordered = eyeGazeLive\n ? [...sources].sort((a, b) => Number(a.kind === \"gaze\") - Number(b.kind === \"gaze\"))\n : sources;\n this.eyeGazeTarget = null;\n let sawGaze = false;\n const seen = new Set<string>();\n const visuals: PointerVisuals[] = [];\n for (const source of ordered) {\n seen.add(source.id);\n if (eyeGazeLive && source.kind === \"gaze\") {\n sawGaze = true;\n this.resolveEyeGaze(source, dt);\n }\n this.updateSource(source, hintBySource.get(source.id) ?? []);\n const state = this.sourceState(source.id);\n visuals.push(pointerVisualsFor(source.id, source.ray !== undefined, state.active, state.candidate));\n }\n if (!sawGaze) {\n // No eye-gaze source this frame (none, or far targeting handed back).\n this.gazeHold = null;\n this.gazeConsensus.reset();\n }\n // Sources that vanished mid-hold release everything they held.\n for (const [id, state] of this.sourceStates) {\n if (!seen.has(id)) {\n this.forceRelease(id, state);\n this.sourceStates.delete(id);\n }\n }\n\n this.updateGaze(sources, dt);\n this.tickBehaviours(sources, dt);\n this.lastVisuals = visuals;\n this.visualsEmitter.emit(visuals);\n }\n\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n // A disposed runtime still owes every held grab exactly one `endHold`\n // (zero velocity - nothing threw it away, the scene just went down),\n // so physics never stays suspended once nothing is left to resume it.\n for (const [id, registered] of this.interactables) {\n if (registered.grabbedBy) {\n this.endGrab(id, registered.grabbedBy, {\n id: registered.grabbedBy,\n kind: \"other\",\n select: 0,\n squeeze: 0,\n });\n }\n }\n this.unsubscribeCaps();\n this.interactables.clear();\n this.sourceStates.clear();\n this.lastSources.clear();\n this.velocityTracker?.reset();\n this.gazeHold = null;\n this.gazePoints.clear();\n this.gazeConsensus.reset();\n this.lastVisuals = [];\n }\n\n // -- eye gaze -----------------------------------------------------------------\n\n /**\n * The targeting half of the eye-gaze rule (`@realitycollective/webxr-input`\n * `eye-gaze.ts` states the whole of it): the cone's best candidate this\n * frame, then the dwell consensus over the window, and nothing at all while\n * a hand's near pointer is hovering or selecting (IWSDK\n * `suppressWhenDirectPointerActive`). A frame with no valid gaze ray clears\n * the record, as IWSDK resets its conecaster, unless a selection is held.\n */\n private resolveEyeGaze(source: InputSourceSnapshot, dt: number): void {\n const ray = source.ray;\n if (!ray) {\n if (!this.gazeHold) this.gazeConsensus.reset();\n this.eyeGazeTarget = null;\n return;\n }\n if (this.eyeGaze.suppressWhenDirectPointerActive && this.directPointerActive()) {\n this.gazeConsensus.skip(dt);\n this.eyeGazeTarget = null;\n return;\n }\n const halfAngle = (this.eyeGaze.coneAngleDegrees * Math.PI) / 180;\n const maxLength = this.eyeGaze.maxRayLength;\n let best: InteractableHit | null = null;\n if (this.hitTester) {\n best = this.hitTester.hitCone\n ? this.hitTester.hitCone(ray, halfAngle, maxLength)\n : this.hitTester.hitRay(ray);\n if (best && (best.distance > maxLength || !this.targetable(best.interactableId))) best = null;\n }\n if (best) this.gazePoints.set(best.interactableId, best.point);\n this.eyeGazeTarget = this.gazeConsensus.update(best?.interactableId ?? null, dt, (id) => this.targetable(id));\n }\n\n /** A hand's near pointer is hovering or selecting: touch or grab owns the hand, or a grab is held. */\n private directPointerActive(): boolean {\n for (const [id, state] of this.sourceStates) {\n const source = this.lastSources.get(id);\n if (!source || (source.handedness !== \"left\" && source.handedness !== \"right\")) continue;\n if (state.grabbed) return true;\n if ((state.active === \"touch\" || state.active === \"grab\") && (state.hoverTarget !== null || state.pressTarget !== null)) return true;\n }\n return false;\n }\n\n /**\n * Once a gaze selection is held, the pinching hand drives the pointer\n * (IWSDK `pointerTransformFollowsHand`): the frame the hold starts, a ray\n * from the hand's ray space is aimed at the gaze hit and its orientation\n * relative to the hand recorded; every later frame the gaze snapshot's ray\n * is that hand's ray space turned by the same amount. When the hand could\n * not reach the hit, or the option is off, the ray stays where the\n * selection was made. Consumers of `onSample` and `getSource`, and every\n * behaviour, see the followed ray.\n */\n private followHand(sources: readonly InputSourceSnapshot[]): readonly InputSourceSnapshot[] {\n const hold = this.gazeHold;\n if (!hold || !this.capabilities.eyeGaze) return sources;\n const index = sources.findIndex((source) => source.id === hold.sourceId);\n if (index < 0) return sources;\n const source = sources[index]!;\n let ray = hold.ray;\n if (hold.relative && source.selectorPose) {\n const quaternion = quatMultiply(source.selectorPose.quaternion, hold.relative);\n ray = { origin: [...source.selectorPose.position], direction: vApplyQuat([0, 0, -1], quaternion) };\n }\n const out = [...sources];\n out[index] = { ...source, ray };\n return out;\n }\n\n /** Start, keep or end the gaze hold from the gaze source's press and grab state this frame. */\n private trackGazeHold(source: InputSourceSnapshot, state: SourceRuntimeState, target: string | null): void {\n if (!state.pressed && !state.grabbed) {\n this.gazeHold = null;\n return;\n }\n if (this.gazeHold?.sourceId === source.id) return;\n if (!source.ray) return;\n let relative: QuatTuple | null = null;\n const point = target ? this.gazePoints.get(target) : undefined;\n const selector = source.selectorPose;\n if (this.eyeGaze.pointerTransformFollowsHand && selector && point) {\n const aim = vSub(point, selector.position);\n if (vLength(aim) > 1e-6) {\n const up = vApplyQuat([0, 1, 0], selector.quaternion);\n const aimed = rayPoseFromRay({ origin: selector.position, direction: vNormalize(aim) }, up);\n const aimedRay: RayTuple = { origin: aimed.position, direction: vApplyQuat([0, 0, -1], aimed.quaternion) };\n // IWSDK follows the hand only when the ray from the hand reaches the target.\n const reaches = this.hitTester ? this.hitTester.hitRay(aimedRay) !== null : true;\n if (reaches) relative = quatMultiply(quatConjugate(selector.quaternion), aimed.quaternion);\n }\n }\n this.gazeHold = { sourceId: source.id, ray: source.ray, relative };\n }\n\n // -- internals ---------------------------------------------------------------\n\n private sourceState(id: string): SourceRuntimeState {\n let state = this.sourceStates.get(id);\n if (!state) {\n state = {\n hoverTarget: null,\n resolvedBy: null,\n pressed: false,\n pressTarget: null,\n grabbed: false,\n grabTarget: null,\n active: null,\n candidate: null,\n touch: new TouchPointerState(),\n };\n this.sourceStates.set(id, state);\n }\n return state;\n }\n\n private interactorInfo(source: InputSourceSnapshot): InteractorInfo {\n const info: InteractorInfo = {\n id: source.id,\n kind: source.kind,\n select: source.select,\n squeeze: source.squeeze,\n };\n if (source.ray) info.ray = source.ray;\n if (source.gripPose) info.gripPose = source.gripPose;\n if (source.indexTip) info.indexTip = source.indexTip;\n if (source.linearVelocity) info.linearVelocity = source.linearVelocity;\n if (source.angularVelocity) info.angularVelocity = source.angularVelocity;\n return info;\n }\n\n /**\n * Resolve this source's target and its active pointer. The pointer is the\n * core rule (`near-pointer.ts`): touch, then grab, then ray, the first with\n * a candidate, locked while it presses or grabs. The target is a provider\n * hint when there is one (provider power: IWSDK's mesh-accurate tags), else\n * the active pointer's candidate. An eye-gaze source targets through the\n * cone and consensus instead.\n */\n private resolveTarget(source: InputSourceSnapshot, hints: InputHitHint[], state: SourceRuntimeState): string | null {\n state.resolvedBy = null;\n const hint =\n hints.find((h) => h.state === \"grab\") ??\n hints.find((h) => h.state === \"press\") ??\n hints.find((h) => h.state === \"hover\");\n if (this.capabilities.eyeGaze && source.kind === \"gaze\") {\n state.active = \"gaze\";\n state.touch.reset();\n const gazeTarget = this.eyeGazeTarget;\n const point = gazeTarget ? this.gazePoints.get(gazeTarget) : undefined;\n state.candidate = gazeTarget && point ? { targetId: gazeTarget, point, distance: 0 } : null;\n if (hint && this.targetable(hint.targetId)) {\n state.resolvedBy = \"hint\";\n return hint.targetId;\n }\n if (gazeTarget !== null) state.resolvedBy = \"gaze\";\n return gazeTarget;\n }\n const touch = this.touchCandidate(source, state);\n const grab = this.grabCandidate(source);\n const ray = this.rayCandidate(source);\n const selecting = state.pressTarget !== null || state.grabTarget !== null;\n const active = pickActivePointer({ touch: touch !== null, grab: grab !== null, ray: ray !== null }, state.active, selecting);\n state.active = active;\n state.candidate = active === \"touch\" ? touch : active === \"grab\" ? grab : active === \"ray\" ? ray : null;\n if (hint && this.targetable(hint.targetId)) {\n state.resolvedBy = \"hint\";\n return hint.targetId;\n }\n if (!state.candidate || !active) return null;\n state.resolvedBy = active === \"touch\" ? \"poke\" : active;\n return state.candidate.targetId;\n }\n\n /**\n * The touch pointer's candidate this frame, advancing the source's touch\n * machine: the nearest target within the widest touch band, hovering by\n * that target's own enter and exit distances. One proximity query at the\n * largest radius any interactable asked for, then the nearest hit must be\n * inside ITS OWN band; the trade is that a farther target with a wider\n * band is not found behind a nearer one with a narrower band.\n */\n private touchCandidate(source: InputSourceSnapshot, state: SourceRuntimeState): PointerCandidate | null {\n const { touchHoverEnter, touchHoverExit, touchDown } = this.nearPointer;\n const hysteresis = touchHoverExit - touchHoverEnter;\n if (!source.indexTip || !this.hitTester) {\n state.touch.update(null, touchHoverEnter, touchHoverExit, touchDown);\n return null;\n }\n const hit = this.hitTester.hitProximity(source.indexTip, this.touchQueryRadius());\n const registered = hit ? this.interactables.get(hit.interactableId) : undefined;\n if (!hit || !registered || !registered.enabled) {\n state.touch.update(null, touchHoverEnter, touchHoverExit, touchDown);\n return null;\n }\n const enter = registered.pokeRadius;\n const update = state.touch.update(hit.distance, enter, enter + hysteresis, touchDown);\n return update.hovering ? { targetId: hit.interactableId, point: hit.point, distance: hit.distance } : null;\n }\n\n /** The grab pointer's candidate: the nearest target whose surface the grip sphere reaches. */\n private grabCandidate(source: InputSourceSnapshot): PointerCandidate | null {\n if (!source.gripPose || !this.hitTester) return null;\n const hit = this.hitTester.hitProximity(source.gripPose.position, this.nearPointer.grabRadius);\n if (!hit || !this.targetable(hit.interactableId)) return null;\n return { targetId: hit.interactableId, point: hit.point, distance: hit.distance };\n }\n\n /** The ray pointer's candidate: the nearest target along the ray. */\n private rayCandidate(source: InputSourceSnapshot): PointerCandidate | null {\n if (!source.ray || !this.hitTester) return null;\n const hit = this.hitTester.hitRay(source.ray);\n if (!hit || !this.targetable(hit.interactableId)) return null;\n return { targetId: hit.interactableId, point: hit.point, distance: hit.distance };\n }\n\n private targetable(id: string): boolean {\n const registered = this.interactables.get(id);\n return registered !== undefined && registered.enabled;\n }\n\n /** The widest touch exit band among enabled interactables; the default exit distance when none is registered. */\n private touchQueryRadius(): number {\n const hysteresis = this.nearPointer.touchHoverExit - this.nearPointer.touchHoverEnter;\n let radius = 0;\n for (const registered of this.interactables.values()) {\n if (registered.enabled && registered.pokeRadius > radius) radius = registered.pokeRadius;\n }\n return radius > 0 ? radius + hysteresis : this.nearPointer.touchHoverExit;\n }\n\n private flags(registered: Registered): { pressable: boolean; grabbable: boolean } {\n let pressable = false;\n let grabbable = false;\n for (const slot of registered.behaviours) {\n if (slot.disabled) continue;\n if (slot.instance.onPressStart) pressable = true;\n if (slot.instance.grabbable) grabbable = true;\n }\n return { pressable, grabbable };\n }\n\n private updateSource(source: InputSourceSnapshot, hints: InputHitHint[]): void {\n const state = this.sourceState(source.id);\n const target = this.resolveTarget(source, hints, state);\n\n // Hover transitions.\n if (state.hoverTarget !== target) {\n if (state.hoverTarget) this.setHover(state.hoverTarget, source.id, false);\n if (target) this.setHover(target, source.id, true);\n state.hoverTarget = target;\n }\n\n const registered = target ? this.interactables.get(target) : undefined;\n const roles = registered ? this.flags(registered) : { pressable: false, grabbable: false };\n\n // Signal resolution. A pinching hand (or a 2D pointer click) acts as a\n // grab when the target is grab-only; controllers keep trigger=press,\n // squeeze=grab.\n const selectAsGrab = roles.grabbable && !roles.pressable && source.kind !== \"controller\";\n const pressSignal = selectAsGrab ? 0 : source.select;\n const grabSignal = Math.max(source.squeeze, selectAsGrab ? source.select : 0);\n\n const hintPress = hints.some((h) => h.state === \"press\");\n const hintGrab = hints.some((h) => h.state === \"grab\") || source.nativeGrabbing === true;\n // The touch press: the fingertip at or under the press distance while\n // touch owns the source (`near-pointer.ts`), with no select needed.\n const touchPress = state.active === \"touch\" && state.touch.isPressed;\n\n // Press with hysteresis (hints and the touch press override).\n const pressActive = hintPress || touchPress || (state.pressed\n ? pressSignal > SELECT_RELEASE_THRESHOLD\n : pressSignal >= SELECT_PRESS_THRESHOLD);\n if (pressActive && !state.pressed) {\n state.pressed = true;\n if (target && registered && roles.pressable && this.gazeAllows(registered)) {\n state.pressTarget = target;\n this.routePressStart(target, registered, this.interactorInfo(source));\n }\n } else if (!pressActive && state.pressed) {\n state.pressed = false;\n if (state.pressTarget) {\n this.routePressEnd(state.pressTarget, source.id, this.interactorInfo(source));\n state.pressTarget = null;\n }\n }\n\n // Grab with hysteresis (hints / native grabbing override).\n const grabActive = hintGrab || (state.grabbed\n ? grabSignal > SELECT_RELEASE_THRESHOLD\n : grabSignal >= SELECT_PRESS_THRESHOLD);\n if (grabActive && !state.grabbed) {\n state.grabbed = true;\n const hintTargetId = hints.find((h) => h.state === \"grab\")?.targetId;\n const grabTargetId = hintTargetId && this.targetable(hintTargetId) ? hintTargetId : target;\n const grabTarget = grabTargetId ? this.interactables.get(grabTargetId) : undefined;\n if (\n grabTargetId &&\n grabTarget &&\n this.flags(grabTarget).grabbable &&\n grabTarget.grabbedBy === null &&\n this.gazeAllows(grabTarget)\n ) {\n state.grabTarget = grabTargetId;\n grabTarget.grabbedBy = source.id;\n const info = this.interactorInfo(source);\n for (const slot of grabTarget.behaviours) {\n if (!slot.disabled && slot.instance.grabbable) {\n slot.instance.onGrabStart?.(this.contextFor(grabTargetId, grabTarget, 0), info);\n }\n }\n }\n } else if (!grabActive && state.grabbed) {\n state.grabbed = false;\n if (state.grabTarget) {\n this.endGrab(state.grabTarget, source.id, this.interactorInfo(source));\n state.grabTarget = null;\n }\n }\n\n if (this.capabilities.eyeGaze && source.kind === \"gaze\") this.trackGazeHold(source, state, target);\n }\n\n private gazeAllows(registered: Registered): boolean {\n return !registered.gazeRequired || registered.gazeHovered;\n }\n\n private setHover(id: string, sourceId: string, hovered: boolean): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n if (hovered) {\n registered.hoveredBy.add(sourceId);\n if (registered.hoveredBy.size === 1) {\n this.events.emit({ type: \"hoverEnter\", interactableId: id, interactorId: sourceId });\n this.feedbackEmitter.emit({\n cue: \"hover\",\n interactableId: id,\n sourceId,\n intensity: 0.1,\n durationMs: 10,\n });\n }\n } else {\n registered.hoveredBy.delete(sourceId);\n if (registered.hoveredBy.size === 0) {\n this.events.emit({ type: \"hoverExit\", interactableId: id, interactorId: sourceId });\n }\n }\n }\n\n private routePressStart(id: string, registered: Registered, info: InteractorInfo): void {\n registered.pressedBy.add(info.id);\n this.events.emit({ type: \"pressStart\", interactableId: id, interactorId: info.id });\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled) slot.instance.onPressStart?.(ctx, info);\n }\n }\n\n private routePressEnd(id: string, sourceId: string, info: InteractorInfo): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n registered.pressedBy.delete(sourceId);\n this.events.emit({ type: \"pressEnd\", interactableId: id, interactorId: sourceId });\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled) slot.instance.onPressEnd?.(ctx, info);\n }\n }\n\n private endGrab(id: string, sourceId: string, info: InteractorInfo): void {\n const registered = this.interactables.get(id);\n if (!registered || registered.grabbedBy !== sourceId) return;\n registered.grabbedBy = null;\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled && slot.instance.grabbable) slot.instance.onGrabEnd?.(ctx, info);\n }\n }\n\n private forceRelease(sourceId: string, state: SourceRuntimeState): void {\n const info: InteractorInfo = { id: sourceId, kind: \"other\", select: 0, squeeze: 0 };\n if (state.pressTarget) this.routePressEnd(state.pressTarget, sourceId, info);\n if (state.grabTarget) this.endGrab(state.grabTarget, sourceId, info);\n if (state.hoverTarget) this.setHover(state.hoverTarget, sourceId, false);\n state.touch.reset();\n state.active = null;\n state.candidate = null;\n }\n\n private releaseAllHolds(id: string): void {\n for (const [sourceId, state] of this.sourceStates) {\n if (state.pressTarget === id) {\n this.routePressEnd(id, sourceId, { id: sourceId, kind: \"other\", select: 0, squeeze: 0 });\n state.pressTarget = null;\n state.pressed = false;\n }\n if (state.grabTarget === id) {\n this.endGrab(id, sourceId, { id: sourceId, kind: \"other\", select: 0, squeeze: 0 });\n state.grabTarget = null;\n state.grabbed = false;\n }\n if (state.hoverTarget === id) {\n this.setHover(id, sourceId, false);\n state.hoverTarget = null;\n }\n }\n }\n\n private updateGaze(sources: readonly InputSourceSnapshot[], dt: number): void {\n let gazeRay: RayTuple | null = null;\n let gazeId = HEAD_GAZE_INTERACTOR_ID;\n const gazeSource = sources.find((s) => s.kind === \"gaze\");\n // Eye gaze, when live, is the gaze for gating and dwell too, with the\n // target the cone and consensus chose (nothing while a near pointer is\n // active, or while the pose is invalid). Otherwise a head-gaze source, or\n // the head pose, targets by plain ray as before.\n const eyeGaze = this.capabilities.eyeGaze && gazeSource !== undefined;\n if (eyeGaze) {\n gazeRay = gazeSource.ray ?? null;\n gazeId = gazeSource.id;\n } else if (gazeSource?.ray) {\n gazeRay = gazeSource.ray;\n gazeId = gazeSource.id;\n } else if (this.capabilities.headPose && this.provider.getHeadPose) {\n const head: PoseTuple = this.provider.getHeadPose();\n gazeRay = {\n origin: head.position,\n direction: vApplyQuat([0, 0, -1], head.quaternion),\n };\n }\n\n const gazeTarget = eyeGaze\n ? this.eyeGazeTarget\n : gazeRay && this.hitTester\n ? (this.hitTester.hitRay(gazeRay)?.interactableId ?? null)\n : null;\n\n for (const [id, registered] of this.interactables) {\n const hovered = registered.enabled && gazeTarget === id;\n if (hovered !== registered.gazeHovered) {\n registered.gazeHovered = hovered;\n this.events.emit({\n type: hovered ? \"hoverEnter\" : \"hoverExit\",\n interactableId: id,\n interactorId: gazeId,\n });\n }\n if (registered.dwellConfig && registered.enabled) {\n const tick = registered.dwell.update(hovered, dt, registered.dwellConfig);\n if (tick.changed) {\n this.events.emit({\n type: \"dwellProgress\",\n interactableId: id,\n interactorId: gazeId,\n value: tick.progress,\n });\n }\n if (tick.fired) {\n // A completed dwell is a synthesized click: press + release.\n const info: InteractorInfo = { id: gazeId, kind: \"gaze\", select: 1, squeeze: 0 };\n this.routePressStart(id, registered, info);\n this.routePressEnd(id, gazeId, { ...info, select: 0 });\n this.feedbackEmitter.emit({\n cue: \"dwellComplete\",\n interactableId: id,\n intensity: 0.6,\n durationMs: 50,\n });\n }\n }\n }\n }\n\n private tickBehaviours(sources: readonly InputSourceSnapshot[], dt: number): void {\n const bySourceId = new Map(sources.map((s) => [s.id, s]));\n for (const [id, registered] of this.interactables) {\n if (!registered.enabled) continue;\n const holderSource = registered.grabbedBy ? bySourceId.get(registered.grabbedBy) : undefined;\n const holder = holderSource ? this.interactorInfo(holderSource) : undefined;\n const ctx = this.contextFor(id, registered, dt);\n for (const slot of registered.behaviours) {\n if (slot.disabled) continue;\n slot.instance.update(ctx, slot.instance.grabbable ? holder : undefined);\n }\n }\n }\n\n private contextFor(id: string, registered: Registered, dt: number) {\n return {\n dt,\n interactableId: id,\n transform: registered.transform,\n emit: (event: Omit<InteractionEvent, \"interactableId\">) =>\n this.events.emit({ ...event, interactableId: id }),\n feedback: (intent: Omit<FeedbackIntent, \"interactableId\">) =>\n this.feedbackEmitter.emit({ ...intent, interactableId: id }),\n getWorldPose: (otherId: string) =>\n this.interactables.get(otherId)?.transform?.getWorldPose(),\n };\n }\n\n private renegotiate(id: string, registered: Registered): void {\n const fulfilment = this.capabilities.grabs === \"native\" ? \"native\" : \"poseOnly\";\n for (const slot of registered.behaviours) {\n if (slot.instance instanceof GrabBehaviour) {\n slot.instance.setFulfilment(fulfilment);\n }\n const unmet = [...unmetRequirements(this.capabilities, slot.instance.requires)];\n for (const group of slot.instance.requiresAnyOf ?? []) {\n if (group.length > 0 && unmetRequirements(this.capabilities, group).length === group.length) {\n unmet.push(group[0]!);\n }\n }\n const disabled = unmet.length > 0;\n if (disabled !== slot.disabled) {\n slot.disabled = disabled;\n slot.disabledReason = disabled ? `unmet input capabilities: ${unmet.join(\", \")}` : \"\";\n this.events.emit({\n type: disabled ? \"behaviourDisabled\" : \"behaviourEnabled\",\n interactableId: id,\n behaviourKind: slot.instance.kind,\n ...(disabled ? { reason: slot.disabledReason } : {}),\n });\n }\n }\n }\n\n private renegotiateAll(): void {\n for (const [id, registered] of this.interactables) {\n this.renegotiate(id, registered);\n }\n }\n}\n\n/** Build a runtime's interactables from a portable descriptor. */\nexport function registerDescriptor(\n runtime: InteractionRuntime,\n descriptor: { interactables: InteractableDescriptor[] },\n portsFor: (id: string) => RegisterPorts = () => ({}),\n): void {\n for (const interactable of descriptor.interactables) {\n runtime.registerInteractable(interactable, portsFor(interactable.id));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,iBAAiB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AAc,EAAE,EAAE;oBAClB,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;oBACjC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACrD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAEO,cAAc;QACpB,KAAK,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AAED,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAChC,OAA2B,EAC3B,UAAuD,EACvD,WAA0C,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IAEpD,KAAK,MAAM,YAAY,IAAI,UAAU,CAAC,aAAa,EAAE,CAAC;QACpD,OAAO,CAAC,oBAAoB,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC","sourcesContent":["/**\n * InteractionRuntime - the engine-free orchestrator.\n *\n * Once per host frame the runtime pulls the input provider, resolves\n * targeting (provider hints first - provider power wins - then poke\n * proximity, then ray hits), applies press/grab transitions with\n * hysteresis, runs gaze gating + dwell, ticks every behaviour, and emits\n * interaction events and feedback intents. It never touches an engine:\n * space queries and transform writes go through the adapter-implemented\n * {@link HitTester} and {@link TransformPort}.\n *\n * Lifecycle is first-class (the pale-signal gap): interactables register,\n * unregister, enable and disable; behaviours disabled by capability\n * negotiation announce themselves with a `behaviourDisabled` event.\n */\nimport {\n PointerArbiter,\n PointerDisplay,\n SELECT_PRESS_THRESHOLD,\n SELECT_RELEASE_THRESHOLD,\n pointerVisualsFor,\n rayPoseFromRay,\n resolveEyeGazeOptions,\n unmetRequirements,\n type ActivePointerKind,\n type EyeGazeOptions,\n type InputCapabilities,\n type InputHitHint,\n type InputProvider,\n type InputSourceSnapshot,\n type PointerCandidate,\n type PointerDisplayConfig,\n type PointerDrawing,\n type PointerOffer,\n type PointerTargetSet,\n type PointerVisuals,\n type PoseTuple,\n type QuatTuple,\n type RayTuple,\n type Unsubscribe,\n type Vec3Tuple,\n} from \"@realitycollective/webxr-input\";\nimport type { Behaviour, InteractorInfo } from \"./behaviours/behaviour.js\";\nimport {\n createBehaviour,\n type BehaviourConfig,\n type BehaviourFactoryContext,\n} from \"./behaviours/factory.js\";\nimport { GrabBehaviour } from \"./behaviours/grab.js\";\nimport type { InteractableDescriptor } from \"./descriptor.js\";\nimport { Emitter, type InteractionEvent, type InteractionEventListener } from \"./events.js\";\nimport type { FeedbackIntent, FeedbackListener } from \"./feedback.js\";\nimport { DwellState, GazeConsensus, resolveDwellConfig, DWELL_DEFAULTS, type DwellConfig } from \"./gaze.js\";\nimport { quatConjugate, quatMultiply, vApplyQuat, vLength, vNormalize, vSub } from \"./math.js\";\nimport type { HitTester, InteractableHit, TransformPort } from \"./ports.js\";\nimport { resolveNearPointerOptions, TouchPointerState, type NearPointerOptions } from \"./near-pointer.js\";\nimport { VelocityTracker, type VelocityTrackerOptions } from \"./velocity-tracker.js\";\n/** Interactor id used when gaze is synthesized from the head pose. */\nexport const HEAD_GAZE_INTERACTOR_ID = \"head-gaze\";\n\nexport interface InteractableState {\n id: string;\n enabled: boolean;\n hovered: boolean;\n gazeHovered: boolean;\n pressed: boolean;\n grabbed: boolean;\n /** Primary behaviour's logical value. */\n value: number;\n /** Gaze-dwell meter 0..1 (0 when dwell is not enabled). */\n dwell: number;\n}\n\ninterface BehaviourSlot {\n instance: Behaviour;\n config: BehaviourConfig;\n disabled: boolean;\n disabledReason: string;\n}\n\ninterface Registered {\n def: InteractableDescriptor;\n behaviours: BehaviourSlot[];\n transform: TransformPort | undefined;\n enabled: boolean;\n /** The touch hover ENTER distance for this target (`InteractableDescriptor.pokeRadius`, else the near-pointer default). */\n pokeRadius: number;\n gazeRequired: boolean;\n dwellConfig: Required<DwellConfig> | null;\n dwell: DwellState;\n gazeHovered: boolean;\n hoveredBy: Set<string>;\n pressedBy: Set<string>;\n grabbedBy: string | null;\n}\n\n/** How a source's target was found this frame; `\"poke\"` and `\"grab\"` mark a near pointer, which suppresses eye gaze. */\ntype ResolvedBy = \"hint\" | \"poke\" | \"grab\" | \"ray\" | \"gaze\" | null;\n\ninterface SourceRuntimeState {\n hoverTarget: string | null;\n resolvedBy: ResolvedBy;\n pressed: boolean;\n pressTarget: string | null;\n grabbed: boolean;\n grabTarget: string | null;\n /** The pointer owning this source this frame (the arbiter's decision). */\n active: ActivePointerKind | null;\n /** The active pointer's candidate, where the cursor sits: this runtime's, or another target set's (a panel). */\n candidate: PointerOffer | null;\n /** The touch pointer's hover and press machine. */\n touch: TouchPointerState;\n}\n\n/** A gaze selection in progress: the pointer the pinching hand took over (see `followHand`). */\ninterface GazeHold {\n sourceId: string;\n /** The gaze ray at the moment of selection, used while the hand cannot follow. */\n ray: RayTuple;\n /** The aimed ray's orientation relative to the hand's ray space, or null when the pointer stays put. */\n relative: QuatTuple | null;\n}\n\nexport interface InteractionRuntimeOptions {\n provider: InputProvider;\n hitTester?: HitTester;\n dwellDefaults?: DwellConfig;\n /**\n * Eye-gaze targeting, when the provider reports `capabilities.eyeGaze`:\n * the selection cone, dwell window, near-pointer suppression and whether a\n * gaze-started drag follows the pinching hand. Defaults are IWSDK 1.0.0's\n * (`EYE_GAZE_DEFAULTS`).\n */\n eyeGaze?: EyeGazeOptions;\n /**\n * Per-source velocity tracking. On by default with no smoothing; pass\n * `false` to skip it, or options to smooth. The tracker only fills in\n * what the provider did not supply.\n */\n velocity?: VelocityTrackerOptions | false;\n /**\n * The near-pointer rule's distances: touch hover enter and exit, touch\n * press, grip grab radius. Defaults are IWSDK 1.0.0's\n * (`NEAR_POINTER_DEFAULTS`). An interactable's own `pokeRadius` overrides\n * the touch hover enter distance for that target alone.\n */\n nearPointer?: Partial<NearPointerOptions>;\n /**\n * The pointer arbiter shared with everything else a pointer can reach (the\n * UI Extensions window hosts), so one decision per source covers panels\n * and interactables alike, as IWSDK's `MultiPointer` does. Omit for a\n * runtime used on its own: it makes one, and decides over its own targets.\n */\n pointers?: PointerArbiter;\n /**\n * The app's pointer display settings (ray never, always or while hitting;\n * cursors on objects and on panels; the ray and cursor look), or a\n * `PointerDisplay` to share. Defaults are IWSDK 1.0.0's. Settable at run\n * time through `getPointerDisplay().set(...)`.\n */\n pointerDisplay?: PointerDisplay | Partial<PointerDisplayConfig>;\n}\n\n/** The target set this runtime registers with its arbiter. */\nexport const INTERACTIONS_POINTER_SET = \"interactions\";\n\nexport interface RegisterPorts {\n transform?: TransformPort;\n}\n\nexport class InteractionRuntime {\n private readonly provider: InputProvider;\n private hitTester: HitTester | null;\n private readonly dwellDefaults: Required<DwellConfig>;\n\n private readonly interactables = new Map<string, Registered>();\n private readonly sourceStates = new Map<string, SourceRuntimeState>();\n private readonly events = new Emitter<InteractionEvent>();\n private readonly feedbackEmitter = new Emitter<FeedbackIntent>();\n private readonly afterSample = new Emitter<readonly InputSourceSnapshot[]>();\n private readonly visualsEmitter = new Emitter<readonly PointerVisuals[]>();\n private readonly drawingEmitter = new Emitter<readonly PointerDrawing[]>();\n private readonly nearPointer: NearPointerOptions;\n private readonly pointers: PointerArbiter;\n private readonly targetSet: PointerTargetSet;\n private readonly pointerDisplay: PointerDisplay;\n private lastVisuals: PointerVisuals[] = [];\n private lastDrawings: PointerDrawing[] = [];\n private readonly velocityTracker: VelocityTracker | null;\n private lastSources = new Map<string, InputSourceSnapshot>();\n private capabilities: InputCapabilities;\n private readonly unsubscribeCaps: Unsubscribe;\n private disposed = false;\n private readonly eyeGaze: Required<EyeGazeOptions>;\n private readonly gazeConsensus: GazeConsensus;\n /** The eye-gaze source's target this frame: cone, consensus and suppression applied. */\n private eyeGazeTarget: string | null = null;\n /** Where the eye-gaze ray last aimed at each target, for the pinching hand to aim at. */\n private readonly gazePoints = new Map<string, Vec3Tuple>();\n private gazeHold: GazeHold | null = null;\n\n constructor(options: InteractionRuntimeOptions) {\n this.provider = options.provider;\n this.hitTester = options.hitTester ?? null;\n this.nearPointer = resolveNearPointerOptions(options.nearPointer);\n this.pointers = options.pointers ?? new PointerArbiter();\n this.targetSet = this.pointers.registerSet(INTERACTIONS_POINTER_SET, \"object\");\n this.pointerDisplay =\n options.pointerDisplay instanceof PointerDisplay ? options.pointerDisplay : new PointerDisplay(options.pointerDisplay);\n this.eyeGaze = resolveEyeGazeOptions(options.eyeGaze);\n this.gazeConsensus = new GazeConsensus(this.eyeGaze.dwellWindowSeconds);\n const d = options.dwellDefaults;\n this.dwellDefaults = {\n holdSeconds: d?.holdSeconds ?? DWELL_DEFAULTS.holdSeconds,\n decayFactor: d?.decayFactor ?? DWELL_DEFAULTS.decayFactor,\n rearmBelow: d?.rearmBelow ?? DWELL_DEFAULTS.rearmBelow,\n };\n this.velocityTracker =\n options.velocity === false ? null : new VelocityTracker(options.velocity ?? {});\n this.capabilities = this.provider.getCapabilities();\n this.unsubscribeCaps = this.provider.onCapabilitiesChanged((caps) => {\n this.capabilities = caps;\n this.renegotiateAll();\n });\n }\n\n // -- registry -------------------------------------------------------------\n\n registerInteractable(def: InteractableDescriptor, ports: RegisterPorts = {}): void {\n if (this.interactables.has(def.id)) {\n throw new Error(`Interactable \"${def.id}\" is already registered`);\n }\n const context: BehaviourFactoryContext = {\n grabFulfilment: this.capabilities.grabs === \"native\" ? \"native\" : \"poseOnly\",\n };\n const registered: Registered = {\n def,\n behaviours: def.behaviours.map((config) => ({\n instance: createBehaviour(config, context),\n config,\n disabled: false,\n disabledReason: \"\",\n })),\n transform: ports.transform,\n enabled: def.enabled !== false,\n pokeRadius: def.pokeRadius ?? this.nearPointer.touchHoverEnter,\n gazeRequired: def.gaze?.required === true,\n dwellConfig: resolveDwellConfig(def.gaze?.dwell, this.dwellDefaults),\n dwell: new DwellState(),\n gazeHovered: false,\n hoveredBy: new Set(),\n pressedBy: new Set(),\n grabbedBy: null,\n };\n this.interactables.set(def.id, registered);\n this.renegotiate(def.id, registered);\n }\n\n unregisterInteractable(id: string): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n this.releaseAllHolds(id);\n this.interactables.delete(id);\n }\n\n setInteractableEnabled(id: string, enabled: boolean): void {\n const registered = this.interactables.get(id);\n if (!registered || registered.enabled === enabled) return;\n registered.enabled = enabled;\n if (!enabled) this.releaseAllHolds(id);\n this.events.emit({\n type: enabled ? \"interactableEnabled\" : \"interactableDisabled\",\n interactableId: id,\n });\n }\n\n setHitTester(hitTester: HitTester | null): void {\n this.hitTester = hitTester;\n }\n\n /** Reach a live behaviour instance for tuning (playground steppers). */\n getBehaviour<T extends Behaviour = Behaviour>(interactableId: string, kind: string): T | undefined {\n const registered = this.interactables.get(interactableId);\n return registered?.behaviours.find((b) => b.instance.kind === kind)?.instance as T | undefined;\n }\n\n getState(id: string): InteractableState | undefined {\n const r = this.interactables.get(id);\n if (!r) return undefined;\n const primary = r.behaviours.find((b) => !b.disabled)?.instance;\n return {\n id,\n enabled: r.enabled,\n hovered: r.hoveredBy.size > 0 || r.gazeHovered,\n gazeHovered: r.gazeHovered,\n pressed: r.pressedBy.size > 0,\n grabbed: r.grabbedBy !== null,\n value: primary?.getValue() ?? 0,\n dwell: r.dwell.getProgress(),\n };\n }\n\n getInteractableIds(): string[] {\n return [...this.interactables.keys()];\n }\n\n // -- subscriptions ----------------------------------------------------------\n\n onEvent(listener: InteractionEventListener): Unsubscribe {\n return this.events.subscribe(listener);\n }\n\n onFeedback(listener: FeedbackListener): Unsubscribe {\n return this.feedbackEmitter.subscribe(listener);\n }\n\n /**\n * Sampled sources for this frame - the UI Extensions pointer bridge hook.\n *\n * @deprecated Use {@link onSample}. Both deliver the same stream: since\n * `@realitycollective/webxr-input` 0.1.1 carries `linearVelocity` and\n * `angularVelocity` on `InputSourceSnapshot`, the two signatures are\n * identical and only one name is needed. This one is kept so existing\n * callers keep working and will be removed in a later major release.\n */\n onSourcesSampled(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe {\n return this.afterSample.subscribe(listener);\n }\n\n /**\n * This frame's sources, velocity included.\n *\n * The snapshots are the provider's own objects for this frame and are\n * never written to again once delivered (the ownership rule on\n * `InputSourceSnapshot`), so a listener may keep one, or a tuple inside\n * it, across frames without copying.\n */\n onSample(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe {\n return this.afterSample.subscribe(listener);\n }\n\n /**\n * The last sample of one source, velocity included. Undefined before the\n * first update, and once the source stops reporting.\n *\n * The snapshot is the caller's to keep: it is never mutated after the\n * frame it was sampled in, and it is not refreshed in place, so call\n * again for a newer one.\n */\n getSource(id: string): InputSourceSnapshot | undefined {\n return this.lastSources.get(id);\n }\n\n getCapabilities(): InputCapabilities {\n return this.capabilities;\n }\n\n getProvider(): InputProvider {\n return this.provider;\n }\n\n /** The near-pointer distances in force (the defaults, or the options given). */\n getNearPointerOptions(): Readonly<NearPointerOptions> {\n return this.nearPointer;\n }\n\n /**\n * The pointer that owns a source this frame: `\"touch\"`, `\"grab\"`, `\"ray\"`\n * or `\"gaze\"`, or null when no pointer has a candidate (or the source is\n * unknown). Decided by the core rule in `near-pointer.ts`, on every\n * platform; a provider hint names the target but never the pointer.\n */\n getActivePointer(sourceId: string): ActivePointerKind | null {\n return this.sourceStates.get(sourceId)?.active ?? null;\n }\n\n /**\n * What to draw for every source this frame: the ray only while the ray is\n * the active pointer or nothing is, the cursor at the active pointer's\n * candidate. Published once per `update`, after the sources; a binding\n * applies it to its ray and cursor visuals, and a native binding hands it\n * to the host as `applyPointerVisuals`. The list and its entries are fresh\n * each frame and never written to again.\n */\n onPointerVisuals(listener: (visuals: readonly PointerVisuals[]) => void): Unsubscribe {\n return this.visualsEmitter.subscribe(listener);\n }\n\n /** The visuals last published for a source, or undefined before its first frame. */\n getPointerVisuals(sourceId: string): PointerVisuals | undefined {\n return this.lastVisuals.find((visuals) => visuals.sourceId === sourceId);\n }\n\n /**\n * What to draw for every source this frame under the app's pointer display\n * settings: the visuals above resolved through `pointerDrawing`. Published\n * right after `onPointerVisuals`. A binding that draws its own ray and\n * cursor applies exactly this; a native binding hands it to the host.\n */\n onPointerDrawing(listener: (drawings: readonly PointerDrawing[]) => void): Unsubscribe {\n return this.drawingEmitter.subscribe(listener);\n }\n\n /** The drawing last published for a source, or undefined before its first frame. */\n getPointerDrawing(sourceId: string): PointerDrawing | undefined {\n return this.lastDrawings.find((drawing) => drawing.sourceId === sourceId);\n }\n\n /** The arbiter deciding which pointer owns each source, shared with the UI Extensions hosts when the app passed one. */\n getPointerArbiter(): PointerArbiter {\n return this.pointers;\n }\n\n /** The app's pointer display settings; `set` changes them at run time. */\n getPointerDisplay(): PointerDisplay {\n return this.pointerDisplay;\n }\n\n /** Whether a source is pressing or grabbing this frame (the selection that recolours its pointer). */\n isSelecting(sourceId: string): boolean {\n const state = this.sourceStates.get(sourceId);\n return state !== undefined && (state.pressTarget !== null || state.grabTarget !== null);\n }\n\n // -- frame ------------------------------------------------------------------\n\n update(dt: number): void {\n if (this.disposed) return;\n const sampled = this.provider.sample();\n const tracked = this.velocityTracker ? this.velocityTracker.update(sampled, dt) : sampled;\n const sources = this.followHand(tracked);\n const hints = this.provider.sampleHints?.() ?? [];\n this.lastSources = new Map(sources.map((source) => [source.id, source]));\n this.afterSample.emit(sources);\n\n const hintBySource = new Map<string, InputHitHint[]>();\n for (const hint of hints) {\n const list = hintBySource.get(hint.sourceId);\n if (list) list.push(hint);\n else hintBySource.set(hint.sourceId, [hint]);\n }\n\n // With eye gaze live, the hands and controllers go first: whether one of\n // them has a near pointer active this frame decides what gaze may target\n // (IWSDK reads the hand pointers' state before it drives the gaze pointer).\n const eyeGazeLive = this.capabilities.eyeGaze;\n const ordered = eyeGazeLive\n ? [...sources].sort((a, b) => Number(a.kind === \"gaze\") - Number(b.kind === \"gaze\"))\n : sources;\n this.eyeGazeTarget = null;\n let sawGaze = false;\n const seen = new Set<string>();\n const visuals: PointerVisuals[] = [];\n for (const source of ordered) {\n seen.add(source.id);\n if (eyeGazeLive && source.kind === \"gaze\") {\n sawGaze = true;\n this.resolveEyeGaze(source, dt);\n }\n this.updateSource(source, hintBySource.get(source.id) ?? []);\n const state = this.sourceState(source.id);\n visuals.push(pointerVisualsFor(source.id, source.ray !== undefined, state.active, state.candidate));\n }\n if (!sawGaze) {\n // No eye-gaze source this frame (none, or far targeting handed back).\n this.gazeHold = null;\n this.gazeConsensus.reset();\n }\n // Sources that vanished mid-hold release everything they held.\n for (const [id, state] of this.sourceStates) {\n if (!seen.has(id)) {\n this.forceRelease(id, state);\n this.sourceStates.delete(id);\n this.pointers.forget(id);\n }\n }\n\n this.updateGaze(sources, dt);\n this.tickBehaviours(sources, dt);\n this.lastVisuals = visuals;\n this.visualsEmitter.emit(visuals);\n const drawings = visuals.map((entry) => this.pointerDisplay.drawing(entry, this.isSelecting(entry.sourceId)));\n this.lastDrawings = drawings;\n this.drawingEmitter.emit(drawings);\n }\n\n dispose(): void {\n this.targetSet.dispose();\n if (this.disposed) return;\n this.disposed = true;\n // A disposed runtime still owes every held grab exactly one `endHold`\n // (zero velocity - nothing threw it away, the scene just went down),\n // so physics never stays suspended once nothing is left to resume it.\n for (const [id, registered] of this.interactables) {\n if (registered.grabbedBy) {\n this.endGrab(id, registered.grabbedBy, {\n id: registered.grabbedBy,\n kind: \"other\",\n select: 0,\n squeeze: 0,\n });\n }\n }\n this.unsubscribeCaps();\n this.interactables.clear();\n this.sourceStates.clear();\n this.lastSources.clear();\n this.velocityTracker?.reset();\n this.gazeHold = null;\n this.gazePoints.clear();\n this.gazeConsensus.reset();\n this.lastVisuals = [];\n }\n\n // -- eye gaze -----------------------------------------------------------------\n\n /**\n * The targeting half of the eye-gaze rule (`@realitycollective/webxr-input`\n * `eye-gaze.ts` states the whole of it): the cone's best candidate this\n * frame, then the dwell consensus over the window, and nothing at all while\n * a hand's near pointer is hovering or selecting (IWSDK\n * `suppressWhenDirectPointerActive`). A frame with no valid gaze ray clears\n * the record, as IWSDK resets its conecaster, unless a selection is held.\n */\n private resolveEyeGaze(source: InputSourceSnapshot, dt: number): void {\n const ray = source.ray;\n if (!ray) {\n if (!this.gazeHold) this.gazeConsensus.reset();\n this.eyeGazeTarget = null;\n return;\n }\n if (this.eyeGaze.suppressWhenDirectPointerActive && this.directPointerActive()) {\n this.gazeConsensus.skip(dt);\n this.eyeGazeTarget = null;\n return;\n }\n const halfAngle = (this.eyeGaze.coneAngleDegrees * Math.PI) / 180;\n const maxLength = this.eyeGaze.maxRayLength;\n let best: InteractableHit | null = null;\n if (this.hitTester) {\n best = this.hitTester.hitCone\n ? this.hitTester.hitCone(ray, halfAngle, maxLength)\n : this.hitTester.hitRay(ray);\n if (best && (best.distance > maxLength || !this.targetable(best.interactableId))) best = null;\n }\n if (best) this.gazePoints.set(best.interactableId, best.point);\n this.eyeGazeTarget = this.gazeConsensus.update(best?.interactableId ?? null, dt, (id) => this.targetable(id));\n }\n\n /** A hand's near pointer is hovering or selecting: touch or grab owns the hand, or a grab is held. */\n private directPointerActive(): boolean {\n for (const [id, state] of this.sourceStates) {\n const source = this.lastSources.get(id);\n if (!source || (source.handedness !== \"left\" && source.handedness !== \"right\")) continue;\n if (state.grabbed) return true;\n if ((state.active === \"touch\" || state.active === \"grab\") && (state.hoverTarget !== null || state.pressTarget !== null)) return true;\n }\n return false;\n }\n\n /**\n * Once a gaze selection is held, the pinching hand drives the pointer\n * (IWSDK `pointerTransformFollowsHand`): the frame the hold starts, a ray\n * from the hand's ray space is aimed at the gaze hit and its orientation\n * relative to the hand recorded; every later frame the gaze snapshot's ray\n * is that hand's ray space turned by the same amount. When the hand could\n * not reach the hit, or the option is off, the ray stays where the\n * selection was made. Consumers of `onSample` and `getSource`, and every\n * behaviour, see the followed ray.\n */\n private followHand(sources: readonly InputSourceSnapshot[]): readonly InputSourceSnapshot[] {\n const hold = this.gazeHold;\n if (!hold || !this.capabilities.eyeGaze) return sources;\n const index = sources.findIndex((source) => source.id === hold.sourceId);\n if (index < 0) return sources;\n const source = sources[index]!;\n let ray = hold.ray;\n if (hold.relative && source.selectorPose) {\n const quaternion = quatMultiply(source.selectorPose.quaternion, hold.relative);\n ray = { origin: [...source.selectorPose.position], direction: vApplyQuat([0, 0, -1], quaternion) };\n }\n const out = [...sources];\n out[index] = { ...source, ray };\n return out;\n }\n\n /** Start, keep or end the gaze hold from the gaze source's press and grab state this frame. */\n private trackGazeHold(source: InputSourceSnapshot, state: SourceRuntimeState, target: string | null): void {\n if (!state.pressed && !state.grabbed) {\n this.gazeHold = null;\n return;\n }\n if (this.gazeHold?.sourceId === source.id) return;\n if (!source.ray) return;\n let relative: QuatTuple | null = null;\n const point = target ? this.gazePoints.get(target) : undefined;\n const selector = source.selectorPose;\n if (this.eyeGaze.pointerTransformFollowsHand && selector && point) {\n const aim = vSub(point, selector.position);\n if (vLength(aim) > 1e-6) {\n const up = vApplyQuat([0, 1, 0], selector.quaternion);\n const aimed = rayPoseFromRay({ origin: selector.position, direction: vNormalize(aim) }, up);\n const aimedRay: RayTuple = { origin: aimed.position, direction: vApplyQuat([0, 0, -1], aimed.quaternion) };\n // IWSDK follows the hand only when the ray from the hand reaches the target.\n const reaches = this.hitTester ? this.hitTester.hitRay(aimedRay) !== null : true;\n if (reaches) relative = quatMultiply(quatConjugate(selector.quaternion), aimed.quaternion);\n }\n }\n this.gazeHold = { sourceId: source.id, ray: source.ray, relative };\n }\n\n // -- internals ---------------------------------------------------------------\n\n private sourceState(id: string): SourceRuntimeState {\n let state = this.sourceStates.get(id);\n if (!state) {\n state = {\n hoverTarget: null,\n resolvedBy: null,\n pressed: false,\n pressTarget: null,\n grabbed: false,\n grabTarget: null,\n active: null,\n candidate: null,\n touch: new TouchPointerState(),\n };\n this.sourceStates.set(id, state);\n }\n return state;\n }\n\n private interactorInfo(source: InputSourceSnapshot): InteractorInfo {\n const info: InteractorInfo = {\n id: source.id,\n kind: source.kind,\n select: source.select,\n squeeze: source.squeeze,\n };\n if (source.ray) info.ray = source.ray;\n if (source.gripPose) info.gripPose = source.gripPose;\n if (source.indexTip) info.indexTip = source.indexTip;\n if (source.linearVelocity) info.linearVelocity = source.linearVelocity;\n if (source.angularVelocity) info.angularVelocity = source.angularVelocity;\n return info;\n }\n\n /**\n * Resolve this source's target and its active pointer. The pointer is the\n * core rule (`near-pointer.ts`): touch, then grab, then ray, the first with\n * a candidate, locked while it presses or grabs. The target is a provider\n * hint when there is one (provider power: IWSDK's mesh-accurate tags), else\n * the active pointer's candidate. An eye-gaze source targets through the\n * cone and consensus instead.\n */\n private resolveTarget(source: InputSourceSnapshot, hints: InputHitHint[], state: SourceRuntimeState): string | null {\n state.resolvedBy = null;\n const hint =\n hints.find((h) => h.state === \"grab\") ??\n hints.find((h) => h.state === \"press\") ??\n hints.find((h) => h.state === \"hover\");\n if (this.capabilities.eyeGaze && source.kind === \"gaze\") {\n state.active = \"gaze\";\n state.touch.reset();\n const gazeTarget = this.eyeGazeTarget;\n const point = gazeTarget ? this.gazePoints.get(gazeTarget) : undefined;\n state.candidate =\n gazeTarget && point ? { targetId: gazeTarget, point, distance: 0, set: this.targetSet.id, targetKind: \"object\" } : null;\n this.pointers.setDecision({ sourceId: source.id, active: \"gaze\", candidate: state.candidate });\n if (hint && this.targetable(hint.targetId)) {\n state.resolvedBy = \"hint\";\n return hint.targetId;\n }\n if (gazeTarget !== null) state.resolvedBy = \"gaze\";\n return gazeTarget;\n }\n // This runtime's own candidates go to the arbiter, which decides across\n // every target set (a UI panel may be nearer than any interactable). A\n // hand or controller is also reachable by its side, so a UI host that\n // knows only the side offers to the same source.\n if (source.handedness === \"left\" || source.handedness === \"right\") this.pointers.alias(source.handedness, source.id);\n this.targetSet.offer(source.id, \"touch\", this.touchCandidate(source, state));\n this.targetSet.offer(source.id, \"grab\", this.grabCandidate(source));\n this.targetSet.offer(source.id, \"ray\", this.rayCandidate(source));\n const decision = this.pointers.resolve(source.id);\n state.active = decision.active;\n state.candidate = decision.candidate;\n if (hint && this.targetable(hint.targetId)) {\n state.resolvedBy = \"hint\";\n return hint.targetId;\n }\n const active = decision.active;\n if (!decision.candidate || !active) return null;\n // Another set's target (a panel) owns the pointer: no interactable is\n // targeted, and the visuals still say where the cursor sits.\n if (decision.candidate.set !== this.targetSet.id) return null;\n state.resolvedBy = active === \"touch\" ? \"poke\" : (active as \"grab\" | \"ray\");\n return decision.candidate.targetId;\n }\n\n /**\n * The touch pointer's candidate this frame, advancing the source's touch\n * machine: the nearest target within the widest touch band, hovering by\n * that target's own enter and exit distances. One proximity query at the\n * largest radius any interactable asked for, then the nearest hit must be\n * inside ITS OWN band; the trade is that a farther target with a wider\n * band is not found behind a nearer one with a narrower band.\n */\n private touchCandidate(source: InputSourceSnapshot, state: SourceRuntimeState): PointerCandidate | null {\n const { touchHoverEnter, touchHoverExit, touchDown } = this.nearPointer;\n const hysteresis = touchHoverExit - touchHoverEnter;\n if (!source.indexTip || !this.hitTester) {\n state.touch.update(null, touchHoverEnter, touchHoverExit, touchDown);\n return null;\n }\n const hit = this.hitTester.hitProximity(source.indexTip, this.touchQueryRadius());\n const registered = hit ? this.interactables.get(hit.interactableId) : undefined;\n if (!hit || !registered || !registered.enabled) {\n state.touch.update(null, touchHoverEnter, touchHoverExit, touchDown);\n return null;\n }\n const enter = registered.pokeRadius;\n const update = state.touch.update(hit.distance, enter, enter + hysteresis, touchDown);\n return update.hovering ? { targetId: hit.interactableId, point: hit.point, distance: hit.distance } : null;\n }\n\n /** The grab pointer's candidate: the nearest target whose surface the grip sphere reaches. */\n private grabCandidate(source: InputSourceSnapshot): PointerCandidate | null {\n if (!source.gripPose || !this.hitTester) return null;\n const hit = this.hitTester.hitProximity(source.gripPose.position, this.nearPointer.grabRadius);\n if (!hit || !this.targetable(hit.interactableId)) return null;\n return { targetId: hit.interactableId, point: hit.point, distance: hit.distance };\n }\n\n /** The ray pointer's candidate: the nearest target along the ray. */\n private rayCandidate(source: InputSourceSnapshot): PointerCandidate | null {\n if (!source.ray || !this.hitTester) return null;\n const hit = this.hitTester.hitRay(source.ray);\n if (!hit || !this.targetable(hit.interactableId)) return null;\n return { targetId: hit.interactableId, point: hit.point, distance: hit.distance };\n }\n\n private targetable(id: string): boolean {\n const registered = this.interactables.get(id);\n return registered !== undefined && registered.enabled;\n }\n\n /** The widest touch exit band among enabled interactables; the default exit distance when none is registered. */\n private touchQueryRadius(): number {\n const hysteresis = this.nearPointer.touchHoverExit - this.nearPointer.touchHoverEnter;\n let radius = 0;\n for (const registered of this.interactables.values()) {\n if (registered.enabled && registered.pokeRadius > radius) radius = registered.pokeRadius;\n }\n return radius > 0 ? radius + hysteresis : this.nearPointer.touchHoverExit;\n }\n\n private flags(registered: Registered): { pressable: boolean; grabbable: boolean } {\n let pressable = false;\n let grabbable = false;\n for (const slot of registered.behaviours) {\n if (slot.disabled) continue;\n if (slot.instance.onPressStart) pressable = true;\n if (slot.instance.grabbable) grabbable = true;\n }\n return { pressable, grabbable };\n }\n\n private updateSource(source: InputSourceSnapshot, hints: InputHitHint[]): void {\n const state = this.sourceState(source.id);\n const target = this.resolveTarget(source, hints, state);\n\n // Hover transitions.\n if (state.hoverTarget !== target) {\n if (state.hoverTarget) this.setHover(state.hoverTarget, source.id, false);\n if (target) this.setHover(target, source.id, true);\n state.hoverTarget = target;\n }\n\n const registered = target ? this.interactables.get(target) : undefined;\n const roles = registered ? this.flags(registered) : { pressable: false, grabbable: false };\n\n // Signal resolution. A pinching hand (or a 2D pointer click) acts as a\n // grab when the target is grab-only; controllers keep trigger=press,\n // squeeze=grab.\n const selectAsGrab = roles.grabbable && !roles.pressable && source.kind !== \"controller\";\n const pressSignal = selectAsGrab ? 0 : source.select;\n const grabSignal = Math.max(source.squeeze, selectAsGrab ? source.select : 0);\n\n const hintPress = hints.some((h) => h.state === \"press\");\n const hintGrab = hints.some((h) => h.state === \"grab\") || source.nativeGrabbing === true;\n // The touch press: the fingertip at or under the press distance while\n // touch owns the source (`near-pointer.ts`), with no select needed.\n const touchPress = state.active === \"touch\" && state.touch.isPressed;\n\n // Press with hysteresis (hints and the touch press override).\n const pressActive = hintPress || touchPress || (state.pressed\n ? pressSignal > SELECT_RELEASE_THRESHOLD\n : pressSignal >= SELECT_PRESS_THRESHOLD);\n if (pressActive && !state.pressed) {\n state.pressed = true;\n if (target && registered && roles.pressable && this.gazeAllows(registered)) {\n state.pressTarget = target;\n this.routePressStart(target, registered, this.interactorInfo(source));\n }\n } else if (!pressActive && state.pressed) {\n state.pressed = false;\n if (state.pressTarget) {\n this.routePressEnd(state.pressTarget, source.id, this.interactorInfo(source));\n state.pressTarget = null;\n }\n }\n\n // Grab with hysteresis (hints / native grabbing override).\n const grabActive = hintGrab || (state.grabbed\n ? grabSignal > SELECT_RELEASE_THRESHOLD\n : grabSignal >= SELECT_PRESS_THRESHOLD);\n if (grabActive && !state.grabbed) {\n state.grabbed = true;\n const hintTargetId = hints.find((h) => h.state === \"grab\")?.targetId;\n const grabTargetId = hintTargetId && this.targetable(hintTargetId) ? hintTargetId : target;\n const grabTarget = grabTargetId ? this.interactables.get(grabTargetId) : undefined;\n if (\n grabTargetId &&\n grabTarget &&\n this.flags(grabTarget).grabbable &&\n grabTarget.grabbedBy === null &&\n this.gazeAllows(grabTarget)\n ) {\n state.grabTarget = grabTargetId;\n grabTarget.grabbedBy = source.id;\n const info = this.interactorInfo(source);\n for (const slot of grabTarget.behaviours) {\n if (!slot.disabled && slot.instance.grabbable) {\n slot.instance.onGrabStart?.(this.contextFor(grabTargetId, grabTarget, 0), info);\n }\n }\n }\n } else if (!grabActive && state.grabbed) {\n state.grabbed = false;\n if (state.grabTarget) {\n this.endGrab(state.grabTarget, source.id, this.interactorInfo(source));\n state.grabTarget = null;\n }\n }\n\n // The selection lock: the pointer that owns this source keeps it while\n // it presses or grabs, whatever appears nearer meanwhile.\n const selecting = state.pressTarget !== null || state.grabTarget !== null;\n for (const kind of [\"touch\", \"grab\", \"ray\"] as const) {\n this.targetSet.setSelecting(source.id, kind, selecting && state.active === kind);\n }\n\n if (this.capabilities.eyeGaze && source.kind === \"gaze\") this.trackGazeHold(source, state, target);\n }\n\n private gazeAllows(registered: Registered): boolean {\n return !registered.gazeRequired || registered.gazeHovered;\n }\n\n private setHover(id: string, sourceId: string, hovered: boolean): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n if (hovered) {\n registered.hoveredBy.add(sourceId);\n if (registered.hoveredBy.size === 1) {\n this.events.emit({ type: \"hoverEnter\", interactableId: id, interactorId: sourceId });\n this.feedbackEmitter.emit({\n cue: \"hover\",\n interactableId: id,\n sourceId,\n intensity: 0.1,\n durationMs: 10,\n });\n }\n } else {\n registered.hoveredBy.delete(sourceId);\n if (registered.hoveredBy.size === 0) {\n this.events.emit({ type: \"hoverExit\", interactableId: id, interactorId: sourceId });\n }\n }\n }\n\n private routePressStart(id: string, registered: Registered, info: InteractorInfo): void {\n registered.pressedBy.add(info.id);\n this.events.emit({ type: \"pressStart\", interactableId: id, interactorId: info.id });\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled) slot.instance.onPressStart?.(ctx, info);\n }\n }\n\n private routePressEnd(id: string, sourceId: string, info: InteractorInfo): void {\n const registered = this.interactables.get(id);\n if (!registered) return;\n registered.pressedBy.delete(sourceId);\n this.events.emit({ type: \"pressEnd\", interactableId: id, interactorId: sourceId });\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled) slot.instance.onPressEnd?.(ctx, info);\n }\n }\n\n private endGrab(id: string, sourceId: string, info: InteractorInfo): void {\n const registered = this.interactables.get(id);\n if (!registered || registered.grabbedBy !== sourceId) return;\n registered.grabbedBy = null;\n const ctx = this.contextFor(id, registered, 0);\n for (const slot of registered.behaviours) {\n if (!slot.disabled && slot.instance.grabbable) slot.instance.onGrabEnd?.(ctx, info);\n }\n }\n\n private forceRelease(sourceId: string, state: SourceRuntimeState): void {\n const info: InteractorInfo = { id: sourceId, kind: \"other\", select: 0, squeeze: 0, synthesized: true };\n if (state.pressTarget) this.routePressEnd(state.pressTarget, sourceId, info);\n if (state.grabTarget) this.endGrab(state.grabTarget, sourceId, info);\n if (state.hoverTarget) this.setHover(state.hoverTarget, sourceId, false);\n state.touch.reset();\n state.active = null;\n state.candidate = null;\n }\n\n private releaseAllHolds(id: string): void {\n for (const [sourceId, state] of this.sourceStates) {\n if (state.pressTarget === id) {\n this.routePressEnd(id, sourceId, { id: sourceId, kind: \"other\", select: 0, squeeze: 0, synthesized: true });\n state.pressTarget = null;\n state.pressed = false;\n }\n if (state.grabTarget === id) {\n this.endGrab(id, sourceId, { id: sourceId, kind: \"other\", select: 0, squeeze: 0, synthesized: true });\n state.grabTarget = null;\n state.grabbed = false;\n }\n if (state.hoverTarget === id) {\n this.setHover(id, sourceId, false);\n state.hoverTarget = null;\n }\n }\n }\n\n private updateGaze(sources: readonly InputSourceSnapshot[], dt: number): void {\n let gazeRay: RayTuple | null = null;\n let gazeId = HEAD_GAZE_INTERACTOR_ID;\n const gazeSource = sources.find((s) => s.kind === \"gaze\");\n // Eye gaze, when live, is the gaze for gating and dwell too, with the\n // target the cone and consensus chose (nothing while a near pointer is\n // active, or while the pose is invalid). Otherwise a head-gaze source, or\n // the head pose, targets by plain ray as before.\n const eyeGaze = this.capabilities.eyeGaze && gazeSource !== undefined;\n if (eyeGaze) {\n gazeRay = gazeSource.ray ?? null;\n gazeId = gazeSource.id;\n } else if (gazeSource?.ray) {\n gazeRay = gazeSource.ray;\n gazeId = gazeSource.id;\n } else if (this.capabilities.headPose && this.provider.getHeadPose) {\n const head: PoseTuple = this.provider.getHeadPose();\n gazeRay = {\n origin: head.position,\n direction: vApplyQuat([0, 0, -1], head.quaternion),\n };\n }\n\n const gazeTarget = eyeGaze\n ? this.eyeGazeTarget\n : gazeRay && this.hitTester\n ? (this.hitTester.hitRay(gazeRay)?.interactableId ?? null)\n : null;\n\n for (const [id, registered] of this.interactables) {\n const hovered = registered.enabled && gazeTarget === id;\n if (hovered !== registered.gazeHovered) {\n registered.gazeHovered = hovered;\n this.events.emit({\n type: hovered ? \"hoverEnter\" : \"hoverExit\",\n interactableId: id,\n interactorId: gazeId,\n });\n }\n if (registered.dwellConfig && registered.enabled) {\n const tick = registered.dwell.update(hovered, dt, registered.dwellConfig);\n if (tick.changed) {\n this.events.emit({\n type: \"dwellProgress\",\n interactableId: id,\n interactorId: gazeId,\n value: tick.progress,\n });\n }\n if (tick.fired) {\n // A completed dwell is a synthesized click: press + release.\n const info: InteractorInfo = { id: gazeId, kind: \"gaze\", select: 1, squeeze: 0 };\n this.routePressStart(id, registered, info);\n this.routePressEnd(id, gazeId, { ...info, select: 0 });\n this.feedbackEmitter.emit({\n cue: \"dwellComplete\",\n interactableId: id,\n intensity: 0.6,\n durationMs: 50,\n });\n }\n }\n }\n }\n\n private tickBehaviours(sources: readonly InputSourceSnapshot[], dt: number): void {\n const bySourceId = new Map(sources.map((s) => [s.id, s]));\n for (const [id, registered] of this.interactables) {\n if (!registered.enabled) continue;\n const holderSource = registered.grabbedBy ? bySourceId.get(registered.grabbedBy) : undefined;\n const holder = holderSource ? this.interactorInfo(holderSource) : undefined;\n const ctx = this.contextFor(id, registered, dt);\n for (const slot of registered.behaviours) {\n if (slot.disabled) continue;\n slot.instance.update(ctx, slot.instance.grabbable ? holder : undefined);\n }\n }\n }\n\n private contextFor(id: string, registered: Registered, dt: number) {\n return {\n dt,\n interactableId: id,\n transform: registered.transform,\n emit: (event: Omit<InteractionEvent, \"interactableId\">) =>\n this.events.emit({ ...event, interactableId: id }),\n feedback: (intent: Omit<FeedbackIntent, \"interactableId\">) =>\n this.feedbackEmitter.emit({ ...intent, interactableId: id }),\n getWorldPose: (otherId: string) =>\n this.interactables.get(otherId)?.transform?.getWorldPose(),\n };\n }\n\n private renegotiate(id: string, registered: Registered): void {\n const fulfilment = this.capabilities.grabs === \"native\" ? \"native\" : \"poseOnly\";\n for (const slot of registered.behaviours) {\n if (slot.instance instanceof GrabBehaviour) {\n slot.instance.setFulfilment(fulfilment);\n }\n const unmet = [...unmetRequirements(this.capabilities, slot.instance.requires)];\n for (const group of slot.instance.requiresAnyOf ?? []) {\n if (group.length > 0 && unmetRequirements(this.capabilities, group).length === group.length) {\n unmet.push(group[0]!);\n }\n }\n const disabled = unmet.length > 0;\n if (disabled !== slot.disabled) {\n slot.disabled = disabled;\n slot.disabledReason = disabled ? `unmet input capabilities: ${unmet.join(\", \")}` : \"\";\n this.events.emit({\n type: disabled ? \"behaviourDisabled\" : \"behaviourEnabled\",\n interactableId: id,\n behaviourKind: slot.instance.kind,\n ...(disabled ? { reason: slot.disabledReason } : {}),\n });\n }\n }\n }\n\n private renegotiateAll(): void {\n for (const [id, registered] of this.interactables) {\n this.renegotiate(id, registered);\n }\n }\n}\n\n/** Build a runtime's interactables from a portable descriptor. */\nexport function registerDescriptor(\n runtime: InteractionRuntime,\n descriptor: { interactables: InteractableDescriptor[] },\n portsFor: (id: string) => RegisterPorts = () => ({}),\n): void {\n for (const interactable of descriptor.interactables) {\n runtime.registerInteractable(interactable, portsFor(interactable.id));\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InteractionTrace } from "./trace.js";
|
|
2
|
+
/** The mechanics a synthetic trace can script, the playground's stations. */
|
|
3
|
+
export type SyntheticMechanic = "press" | "grab-throw" | "dial" | "slide" | "hinge";
|
|
4
|
+
export interface SynthesizeTraceOptions {
|
|
5
|
+
mechanic: SyntheticMechanic;
|
|
6
|
+
/** Frames per second of the scripted session. Default 72 (a Quest 3). */
|
|
7
|
+
frameRate?: number;
|
|
8
|
+
/** `"hands"` scripts a binary pinch, `"controllers"` an analog trigger and squeeze. Default hands. */
|
|
9
|
+
input?: "hands" | "controllers";
|
|
10
|
+
}
|
|
11
|
+
/** Run a scripted mechanic through the core over memory ports and record it. */
|
|
12
|
+
export declare function synthesizeTrace(options: SynthesizeTraceOptions): InteractionTrace;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic traces: a scripted session run through the core itself over the
|
|
3
|
+
* engine-free memory ports and recorded in the trace format. They exist to
|
|
4
|
+
* prove the trace pipeline runs on every binding in CI (the recorder, the
|
|
5
|
+
* replay, the comparison and each binding's subject) before a person has
|
|
6
|
+
* recorded a real session on a Quest 3. Their `meta.synthetic` is true and
|
|
7
|
+
* every case they produce says so: a synthetic trace proves nothing about
|
|
8
|
+
* parity with the web, because its reference outcome is the core's own.
|
|
9
|
+
*/
|
|
10
|
+
import { NO_CAPABILITIES } from "@realitycollective/webxr-input";
|
|
11
|
+
import { quatFromAxisAngle } from "./math.js";
|
|
12
|
+
import { MemoryHitTester, MemoryTransformPort } from "./memory-ports.js";
|
|
13
|
+
import { InteractionRuntime } from "./runtime.js";
|
|
14
|
+
import { TraceRecorder } from "./trace.js";
|
|
15
|
+
class ScriptedProvider {
|
|
16
|
+
sources = [];
|
|
17
|
+
capabilities = {
|
|
18
|
+
...NO_CAPABILITIES,
|
|
19
|
+
rays: true,
|
|
20
|
+
pokes: true,
|
|
21
|
+
grabs: "poseOnly",
|
|
22
|
+
handJoints: true,
|
|
23
|
+
pinch: true,
|
|
24
|
+
headPose: true,
|
|
25
|
+
gaze: true,
|
|
26
|
+
};
|
|
27
|
+
getCapabilities() {
|
|
28
|
+
return this.capabilities;
|
|
29
|
+
}
|
|
30
|
+
onCapabilitiesChanged() {
|
|
31
|
+
return () => undefined;
|
|
32
|
+
}
|
|
33
|
+
onSourcesChanged() {
|
|
34
|
+
return () => undefined;
|
|
35
|
+
}
|
|
36
|
+
sample() {
|
|
37
|
+
return this.sources;
|
|
38
|
+
}
|
|
39
|
+
getHeadPose() {
|
|
40
|
+
return { position: [0, 1.6, 0], quaternion: [0, 0, 0, 1] };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** The right hand at a point, pinching or not, its grip 6 cm behind the fingertip along +Z. */
|
|
44
|
+
function hand(tip, pinch, input, gripAt) {
|
|
45
|
+
const grip = gripAt ?? [tip[0], tip[1], tip[2] + 0.06];
|
|
46
|
+
return {
|
|
47
|
+
id: "right-hand",
|
|
48
|
+
kind: input === "hands" ? "hand" : "controller",
|
|
49
|
+
handedness: "right",
|
|
50
|
+
select: input === "hands" ? (pinch ? 1 : 0) : pinch ? 0.9 : 0,
|
|
51
|
+
squeeze: input === "hands" ? 0 : pinch ? 0.9 : 0,
|
|
52
|
+
ray: { origin: [grip[0], grip[1], grip[2]], direction: [0, 0, -1] },
|
|
53
|
+
gripPose: { position: grip, quaternion: [0, 0, 0, 1] },
|
|
54
|
+
indexTip: input === "hands" ? tip : grip,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const TARGET = [0, 1.1, -0.5];
|
|
58
|
+
const RADIUS = 0.06;
|
|
59
|
+
/** The station a mechanic uses, at the playground's toss position. */
|
|
60
|
+
function target(mechanic) {
|
|
61
|
+
switch (mechanic) {
|
|
62
|
+
case "press":
|
|
63
|
+
return { id: "pg-button", behaviours: [{ kind: "press", axis: [0, 1, 0], travel: 0.045, depthFraction: 0.6 }] };
|
|
64
|
+
case "grab-throw":
|
|
65
|
+
return { id: "pg-ball", behaviours: [{ kind: "grab" }], pokeRadius: 0.09 };
|
|
66
|
+
case "dial":
|
|
67
|
+
return { id: "pg-dial", behaviours: [{ kind: "dial", axis: [0, 1, 0], maxAngle: (3 * Math.PI) / 2 }] };
|
|
68
|
+
case "slide":
|
|
69
|
+
return { id: "pg-pulley", behaviours: [{ kind: "slide", axis: [0, 1, 0], travel: 0.3 }] };
|
|
70
|
+
case "hinge":
|
|
71
|
+
return { id: "pg-lever-table", behaviours: [{ kind: "hinge", axis: [1, 0, 0], restDir: [0, 1, 0], maxAngle: (50 * Math.PI) / 180 }] };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The scripted frames of a mechanic: the fingertip's path and whether the hand pinches. */
|
|
75
|
+
function* script(mechanic, frameRate) {
|
|
76
|
+
const n = (seconds) => Math.round(seconds * frameRate);
|
|
77
|
+
const lerp = (a, b, k) => [a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k, a[2] + (b[2] - a[2]) * k];
|
|
78
|
+
const far = [0, 1.1, 0.2];
|
|
79
|
+
const nearSurface = [TARGET[0], TARGET[1], TARGET[2] + RADIUS + 0.01];
|
|
80
|
+
switch (mechanic) {
|
|
81
|
+
case "press": {
|
|
82
|
+
const contact = [TARGET[0], TARGET[1] + RADIUS - 0.01, TARGET[2]];
|
|
83
|
+
const above = [TARGET[0], TARGET[1] + RADIUS + 0.1, TARGET[2]];
|
|
84
|
+
for (let i = 0; i < n(0.5); i += 1)
|
|
85
|
+
yield { tip: lerp(far, above, i / n(0.5)), pinch: false };
|
|
86
|
+
for (let i = 0; i <= n(0.3); i += 1)
|
|
87
|
+
yield { tip: lerp(above, contact, i / n(0.3)), pinch: false };
|
|
88
|
+
for (let i = 0; i < n(0.2); i += 1)
|
|
89
|
+
yield { tip: contact, pinch: false };
|
|
90
|
+
for (let i = 0; i <= n(0.3); i += 1)
|
|
91
|
+
yield { tip: lerp(contact, above, i / n(0.3)), pinch: false };
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
case "grab-throw": {
|
|
95
|
+
const gripAtBall = [TARGET[0], TARGET[1], TARGET[2] + RADIUS + 0.02];
|
|
96
|
+
const thrown = [0, 1.4, -1.2];
|
|
97
|
+
for (let i = 0; i < n(0.5); i += 1)
|
|
98
|
+
yield { tip: lerp(far, gripAtBall, i / n(0.5)), pinch: false, grip: lerp(far, gripAtBall, i / n(0.5)) };
|
|
99
|
+
for (let i = 0; i < n(0.2); i += 1)
|
|
100
|
+
yield { tip: gripAtBall, pinch: true, grip: gripAtBall };
|
|
101
|
+
// The throw: the grip accelerates forward over 0.25 s and lets go at speed.
|
|
102
|
+
const throwFrames = n(0.25);
|
|
103
|
+
for (let i = 0; i <= throwFrames; i += 1) {
|
|
104
|
+
const k = i / throwFrames;
|
|
105
|
+
const eased = k * k;
|
|
106
|
+
yield { tip: lerp(gripAtBall, thrown, eased), pinch: i < throwFrames, grip: lerp(gripAtBall, thrown, eased) };
|
|
107
|
+
}
|
|
108
|
+
for (let i = 0; i < n(0.3); i += 1)
|
|
109
|
+
yield { tip: thrown, pinch: false, grip: thrown };
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
case "dial": {
|
|
113
|
+
// The grip circles the knob's axis a quarter turn, 5 cm out, while pinching.
|
|
114
|
+
const r = RADIUS + 0.03;
|
|
115
|
+
const at = (angle) => [TARGET[0] + r * Math.sin(angle), TARGET[1], TARGET[2] + r * Math.cos(angle)];
|
|
116
|
+
for (let i = 0; i < n(0.4); i += 1)
|
|
117
|
+
yield { tip: lerp(far, at(0), i / n(0.4)), pinch: false, grip: lerp(far, at(0), i / n(0.4)) };
|
|
118
|
+
for (let i = 0; i < n(0.1); i += 1)
|
|
119
|
+
yield { tip: at(0), pinch: true, grip: at(0) };
|
|
120
|
+
for (let i = 0; i <= n(0.6); i += 1)
|
|
121
|
+
yield { tip: at((Math.PI / 2) * (i / n(0.6))), pinch: true, grip: at((Math.PI / 2) * (i / n(0.6))) };
|
|
122
|
+
for (let i = 0; i < n(0.2); i += 1)
|
|
123
|
+
yield { tip: at(Math.PI / 2), pinch: false, grip: at(Math.PI / 2) };
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
case "slide": {
|
|
127
|
+
const pulled = [nearSurface[0], nearSurface[1] - 0.25, nearSurface[2]];
|
|
128
|
+
for (let i = 0; i < n(0.4); i += 1)
|
|
129
|
+
yield { tip: lerp(far, nearSurface, i / n(0.4)), pinch: false, grip: lerp(far, nearSurface, i / n(0.4)) };
|
|
130
|
+
for (let i = 0; i < n(0.1); i += 1)
|
|
131
|
+
yield { tip: nearSurface, pinch: true, grip: nearSurface };
|
|
132
|
+
for (let i = 0; i <= n(0.5); i += 1)
|
|
133
|
+
yield { tip: lerp(nearSurface, pulled, i / n(0.5)), pinch: true, grip: lerp(nearSurface, pulled, i / n(0.5)) };
|
|
134
|
+
for (let i = 0; i < n(0.5); i += 1)
|
|
135
|
+
yield { tip: pulled, pinch: false, grip: pulled };
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
case "hinge": {
|
|
139
|
+
const swung = [nearSurface[0], nearSurface[1] - 0.1, nearSurface[2] + 0.15];
|
|
140
|
+
for (let i = 0; i < n(0.4); i += 1)
|
|
141
|
+
yield { tip: lerp(far, nearSurface, i / n(0.4)), pinch: false, grip: lerp(far, nearSurface, i / n(0.4)) };
|
|
142
|
+
for (let i = 0; i < n(0.1); i += 1)
|
|
143
|
+
yield { tip: nearSurface, pinch: true, grip: nearSurface };
|
|
144
|
+
for (let i = 0; i <= n(0.5); i += 1)
|
|
145
|
+
yield { tip: lerp(nearSurface, swung, i / n(0.5)), pinch: true, grip: lerp(nearSurface, swung, i / n(0.5)) };
|
|
146
|
+
for (let i = 0; i < n(0.2); i += 1)
|
|
147
|
+
yield { tip: swung, pinch: false, grip: swung };
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/** Run a scripted mechanic through the core over memory ports and record it. */
|
|
153
|
+
export function synthesizeTrace(options) {
|
|
154
|
+
const frameRate = options.frameRate ?? 72;
|
|
155
|
+
const input = options.input ?? "hands";
|
|
156
|
+
const dt = 1 / frameRate;
|
|
157
|
+
const descriptor = target(options.mechanic);
|
|
158
|
+
const rest = { position: [TARGET[0], TARGET[1], TARGET[2]], quaternion: options.mechanic === "hinge" ? quatFromAxisAngle([0, 1, 0], 0) : [0, 0, 0, 1] };
|
|
159
|
+
const hitTester = new MemoryHitTester();
|
|
160
|
+
const port = new MemoryTransformPort(rest);
|
|
161
|
+
hitTester.place(descriptor.id, rest.position, RADIUS, port);
|
|
162
|
+
const provider = new ScriptedProvider();
|
|
163
|
+
const runtime = new InteractionRuntime({ provider, hitTester });
|
|
164
|
+
runtime.registerInteractable(descriptor, { transform: port });
|
|
165
|
+
const recorder = new TraceRecorder(runtime, {
|
|
166
|
+
meta: {
|
|
167
|
+
platform: "core",
|
|
168
|
+
device: "synthetic",
|
|
169
|
+
mechanic: options.mechanic,
|
|
170
|
+
input,
|
|
171
|
+
synthetic: true,
|
|
172
|
+
notes: "A scripted session through the core over memory ports. Proves the trace pipeline, never parity with the web.",
|
|
173
|
+
},
|
|
174
|
+
targets: [{ descriptor, port, radius: RADIUS }],
|
|
175
|
+
head: () => provider.getHeadPose(),
|
|
176
|
+
releases: () => {
|
|
177
|
+
const last = port.releases[port.releases.length - 1];
|
|
178
|
+
if (!last || port.releases.length === releasesSeen)
|
|
179
|
+
return undefined;
|
|
180
|
+
releasesSeen = port.releases.length;
|
|
181
|
+
return { [descriptor.id]: last };
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
let releasesSeen = 0;
|
|
185
|
+
for (const frame of script(options.mechanic, frameRate)) {
|
|
186
|
+
provider.sources = [hand(frame.tip, frame.pinch, input, frame.grip)];
|
|
187
|
+
runtime.update(dt);
|
|
188
|
+
recorder.endFrame(dt);
|
|
189
|
+
}
|
|
190
|
+
const trace = recorder.stop();
|
|
191
|
+
runtime.dispose();
|
|
192
|
+
return trace;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=trace-synthetic.js.map
|