@relu-interactives/spatial-ecs 0.3.18 → 0.3.20

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.
Files changed (40) hide show
  1. package/dist/{XRHandPose-B8xxFb9A.d.cts → XRHandPose-CLl4MiHx.d.cts} +12 -2
  2. package/dist/{XRHandPose-ubMe5Igc.d.ts → XRHandPose-CrzI57JA.d.ts} +12 -2
  3. package/dist/{chunk-7SSOZWXM.js → chunk-CDSE7476.js} +82 -6
  4. package/dist/chunk-CDSE7476.js.map +1 -0
  5. package/dist/{chunk-PFE2SDXR.js → chunk-D6KXWNYT.js} +3 -3
  6. package/dist/{chunk-PFE2SDXR.js.map → chunk-D6KXWNYT.js.map} +1 -1
  7. package/dist/{chunk-J3EUNW57.js → chunk-H6DQ7JRE.js} +48 -18
  8. package/dist/chunk-H6DQ7JRE.js.map +1 -0
  9. package/dist/{chunk-KRWBNC6Y.js → chunk-P42OE3RU.js} +4 -4
  10. package/dist/{chunk-KRWBNC6Y.js.map → chunk-P42OE3RU.js.map} +1 -1
  11. package/dist/components/index.cjs +33 -10
  12. package/dist/components/index.cjs.map +1 -1
  13. package/dist/components/index.d.cts +3 -3
  14. package/dist/components/index.d.ts +3 -3
  15. package/dist/components/index.js +1 -1
  16. package/dist/docs/guide/vr-and-hand-poses.md +167 -0
  17. package/dist/factories/index.cjs +8 -0
  18. package/dist/factories/index.cjs.map +1 -1
  19. package/dist/factories/index.d.cts +2 -2
  20. package/dist/factories/index.d.ts +2 -2
  21. package/dist/factories/index.js +3 -3
  22. package/dist/{handPose-dFxqbFFY.d.cts → handPose-DlcTtqgx.d.cts} +26 -1
  23. package/dist/{handPose-dFxqbFFY.d.ts → handPose-DlcTtqgx.d.ts} +26 -1
  24. package/dist/{index-D7aSZ-e9.d.ts → index-6l4hn2Sh.d.ts} +15 -1
  25. package/dist/{index-7CFf45fo.d.cts → index-C2I5PxCI.d.cts} +15 -1
  26. package/dist/{index-DhWfxUgL.d.ts → index-JRcoel9F.d.ts} +3 -2
  27. package/dist/{index-CA9fqh4Z.d.cts → index-g777AmFv.d.cts} +3 -2
  28. package/dist/index.cjs +123 -16
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +11 -8
  31. package/dist/index.d.ts +11 -8
  32. package/dist/index.js +8 -8
  33. package/dist/systems/index.cjs +114 -16
  34. package/dist/systems/index.cjs.map +1 -1
  35. package/dist/systems/index.d.cts +2 -2
  36. package/dist/systems/index.d.ts +2 -2
  37. package/dist/systems/index.js +3 -3
  38. package/package.json +1 -1
  39. package/dist/chunk-7SSOZWXM.js.map +0 -1
  40. package/dist/chunk-J3EUNW57.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { k as EcsSystem, C as Component, W as WorldEntityView, T as TransformComponent, l as World, S as SpawnPrefabSource, m as SpawnPrefabOptions, n as ComponentClass, o as ParentLookup, p as EcsEntityKind, O as ObjectManagementSystem, q as SubtreeSnapshot, r as EntityId, s as ExternalRefWarning } from './System-BhnLw0fZ.cjs';
2
2
  export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFactory, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, B as EcsComponentFactoryKind, F as EcsEntityEditorKind, G as EntityInput, H as FloatInput, I as InputSystem, J as IntersectionResult, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, N as PREFAB_FILE_VERSION, Q as PREFAB_FILE_VERSION_NESTED, R as PrefabAsset, U as RemapSnapshotOptions, X as RenderSystem, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a0 as TransformSyncSystem, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, a4 as clearPrefabCache, a5 as despawnPrefab, a6 as loadPrefab, a7 as parsePrefabAsset, a8 as prefabFileVersionFor, a9 as remapSnapshotEntityIds, aa as setPrefabAssetUrlResolver, ab as spawnPrefab } from './System-BhnLw0fZ.cjs';
3
3
  import * as THREE from 'three';
4
- import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-B8xxFb9A.cjs';
5
- export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-B8xxFb9A.cjs';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-7CFf45fo.cjs';
7
- export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-7CFf45fo.cjs';
8
- export { i as CoreComponents } from './index-CA9fqh4Z.cjs';
4
+ import { O as Object3DRef, ao as XrHandPreset } from './XRHandPose-CLl4MiHx.cjs';
5
+ export { aA as AnimationStateCallbacks, aB as AnimationStateMachine, aC as AnimationStateManager, aD as StateMachine } from './XRHandPose-CLl4MiHx.cjs';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-C2I5PxCI.cjs';
7
+ export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-C2I5PxCI.cjs';
8
+ export { i as CoreComponents } from './index-g777AmFv.cjs';
9
9
  export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './factories/index.cjs';
10
10
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
11
- import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.cjs';
12
- export { C as CURLED_COS, D as DEFAULT_ENTER_CONFIDENCE, c as DEFAULT_EXIT_CONFIDENCE, d as DEFAULT_LOST_GRACE_SECONDS, e as DEFAULT_MIN_HOLD_SECONDS, F as FALLBACK_HAND_SCALE, H as HandPoseTracker, f as HandPoseTrackerOptions, M as MATCH_FALLOFF, P as PINCH_FINGERS, S as STRAIGHT_COS, g as XR_FINGERS, h as XrFingerCurl, i as XrFingerTarget, j as XrHandJointName, k as XrHandJoints, l as XrHandPoseAxis, m as XrHandPoseContext, n as XrHandPoseDirection, o as XrHandPoseEvent, p as XrHandPoseMatch, q as XrHandShape, r as XrPalmPose, s as computeFingerCurl, t as computeHandShape, u as computePalmPose, v as computePalmWidth, w as computePinch, x as computeSpread, y as estimateHandScale, z as matchHandPose } from './handPose-dFxqbFFY.cjs';
11
+ import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation, c as XrHandPoseDirection } from './handPose-DlcTtqgx.cjs';
12
+ export { C as CURLED_COS, D as DEFAULT_DIRECTION_TOLERANCE, d as DEFAULT_ENTER_CONFIDENCE, e as DEFAULT_EXIT_CONFIDENCE, f as DEFAULT_LOST_GRACE_SECONDS, g as DEFAULT_MIN_HOLD_SECONDS, F as FALLBACK_HAND_SCALE, H as HandPoseTracker, h as HandPoseTrackerOptions, M as MATCH_FALLOFF, P as PINCH_FINGERS, S as STRAIGHT_COS, i as XR_FINGERS, j as XrFingerCurl, k as XrFingerTarget, l as XrHandJointName, m as XrHandJoints, n as XrHandPoseAxis, o as XrHandPoseContext, p as XrHandPoseEvent, q as XrHandPoseMatch, r as XrHandShape, s as XrPalmPose, t as computeFingerCurl, u as computeHandShape, v as computePalmPose, w as computePalmWidth, x as computePinch, y as computeSpread, z as estimateHandScale, A as matchHandPose } from './handPose-DlcTtqgx.cjs';
13
13
  import '@dimforge/rapier3d-compat';
14
14
 
15
15
  interface CustomEcsSystem extends EcsSystem {
@@ -895,6 +895,9 @@ declare function handPoseFromCurls(id: string, name: string, curls: Record<XrFin
895
895
  pinch?: XrHandPoseDefinition["pinch"];
896
896
  orientation?: XrHandPoseOrientation;
897
897
  hand?: "left" | "right";
898
+ /** Per-finger accepted directions; empty lists leave a finger free. */
899
+ directions?: Partial<Record<XrFinger, XrHandPoseDirection[]>>;
900
+ directionToleranceDegrees?: number;
898
901
  }): XrHandPoseDefinition;
899
902
 
900
903
  /**
@@ -965,4 +968,4 @@ declare class ThrowVelocityTracker {
965
968
  */
966
969
  declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
967
970
 
968
- export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, TeleportAimGate, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
971
+ export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, TeleportAimGate, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseDirection, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { k as EcsSystem, C as Component, W as WorldEntityView, T as TransformComponent, l as World, S as SpawnPrefabSource, m as SpawnPrefabOptions, n as ComponentClass, o as ParentLookup, p as EcsEntityKind, O as ObjectManagementSystem, q as SubtreeSnapshot, r as EntityId, s as ExternalRefWarning } from './System-BhnLw0fZ.js';
2
2
  export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFactory, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, B as EcsComponentFactoryKind, F as EcsEntityEditorKind, G as EntityInput, H as FloatInput, I as InputSystem, J as IntersectionResult, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, N as PREFAB_FILE_VERSION, Q as PREFAB_FILE_VERSION_NESTED, R as PrefabAsset, U as RemapSnapshotOptions, X as RenderSystem, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a0 as TransformSyncSystem, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, a4 as clearPrefabCache, a5 as despawnPrefab, a6 as loadPrefab, a7 as parsePrefabAsset, a8 as prefabFileVersionFor, a9 as remapSnapshotEntityIds, aa as setPrefabAssetUrlResolver, ab as spawnPrefab } from './System-BhnLw0fZ.js';
3
3
  import * as THREE from 'three';
4
- import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-ubMe5Igc.js';
5
- export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-ubMe5Igc.js';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-D7aSZ-e9.js';
7
- export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-D7aSZ-e9.js';
8
- export { i as CoreComponents } from './index-DhWfxUgL.js';
4
+ import { O as Object3DRef, ao as XrHandPreset } from './XRHandPose-CrzI57JA.js';
5
+ export { aA as AnimationStateCallbacks, aB as AnimationStateMachine, aC as AnimationStateManager, aD as StateMachine } from './XRHandPose-CrzI57JA.js';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-6l4hn2Sh.js';
7
+ export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-6l4hn2Sh.js';
8
+ export { i as CoreComponents } from './index-JRcoel9F.js';
9
9
  export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './factories/index.js';
10
10
  import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
11
- import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.js';
12
- export { C as CURLED_COS, D as DEFAULT_ENTER_CONFIDENCE, c as DEFAULT_EXIT_CONFIDENCE, d as DEFAULT_LOST_GRACE_SECONDS, e as DEFAULT_MIN_HOLD_SECONDS, F as FALLBACK_HAND_SCALE, H as HandPoseTracker, f as HandPoseTrackerOptions, M as MATCH_FALLOFF, P as PINCH_FINGERS, S as STRAIGHT_COS, g as XR_FINGERS, h as XrFingerCurl, i as XrFingerTarget, j as XrHandJointName, k as XrHandJoints, l as XrHandPoseAxis, m as XrHandPoseContext, n as XrHandPoseDirection, o as XrHandPoseEvent, p as XrHandPoseMatch, q as XrHandShape, r as XrPalmPose, s as computeFingerCurl, t as computeHandShape, u as computePalmPose, v as computePalmWidth, w as computePinch, x as computeSpread, y as estimateHandScale, z as matchHandPose } from './handPose-dFxqbFFY.js';
11
+ import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation, c as XrHandPoseDirection } from './handPose-DlcTtqgx.js';
12
+ export { C as CURLED_COS, D as DEFAULT_DIRECTION_TOLERANCE, d as DEFAULT_ENTER_CONFIDENCE, e as DEFAULT_EXIT_CONFIDENCE, f as DEFAULT_LOST_GRACE_SECONDS, g as DEFAULT_MIN_HOLD_SECONDS, F as FALLBACK_HAND_SCALE, H as HandPoseTracker, h as HandPoseTrackerOptions, M as MATCH_FALLOFF, P as PINCH_FINGERS, S as STRAIGHT_COS, i as XR_FINGERS, j as XrFingerCurl, k as XrFingerTarget, l as XrHandJointName, m as XrHandJoints, n as XrHandPoseAxis, o as XrHandPoseContext, p as XrHandPoseEvent, q as XrHandPoseMatch, r as XrHandShape, s as XrPalmPose, t as computeFingerCurl, u as computeHandShape, v as computePalmPose, w as computePalmWidth, x as computePinch, y as computeSpread, z as estimateHandScale, A as matchHandPose } from './handPose-DlcTtqgx.js';
13
13
  import '@dimforge/rapier3d-compat';
14
14
 
15
15
  interface CustomEcsSystem extends EcsSystem {
@@ -895,6 +895,9 @@ declare function handPoseFromCurls(id: string, name: string, curls: Record<XrFin
895
895
  pinch?: XrHandPoseDefinition["pinch"];
896
896
  orientation?: XrHandPoseOrientation;
897
897
  hand?: "left" | "right";
898
+ /** Per-finger accepted directions; empty lists leave a finger free. */
899
+ directions?: Partial<Record<XrFinger, XrHandPoseDirection[]>>;
900
+ directionToleranceDegrees?: number;
898
901
  }): XrHandPoseDefinition;
899
902
 
900
903
  /**
@@ -965,4 +968,4 @@ declare class ThrowVelocityTracker {
965
968
  */
966
969
  declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
967
970
 
968
- export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, TeleportAimGate, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
971
+ export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, TeleportAimGate, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseDirection, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-7SSOZWXM.js';
2
- export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, AnimationSystem, AudioSystem, Behaviour, CURLED_COS, CameraSyncSystem, DEFAULT_ENTER_CONFIDENCE, DEFAULT_EXIT_CONFIDENCE, DEFAULT_LOST_GRACE_SECONDS, DEFAULT_MIN_HOLD_SECONDS, EnvironmentSyncSystem, FALLBACK_HAND_SCALE, HYDRATABLE_ENTITY_KINDS, HandPoseTracker, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MATCH_FALLOFF, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, MaterialSyncSystem, MeshGeometrySystem, NODE_KEY_SEPARATOR, NO_XR_CAPABILITIES, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectVisibilitySystem, PINCH_FINGERS, PREFAB_FILE_VERSION, PREFAB_FILE_VERSION_NESTED, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, STRAIGHT_COS, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, TeleportAimGate, ThrowVelocityTracker, TransformSyncSystem, VELOCITY_SAMPLES, VRTeleportAreaSystem, VideoSystem, XRControllerVisualSystem, XRHandPoseSystem, XRHoverVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, XR_HOVER_SHELL_FLAG, angularVelocityFrom, applyHandMaterial, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearPrefabCache, collectDiffPaths, collectEntitySubtree, collectSnapshotSubtreeIds, computeFingerCurl, computeHandShape, computeInstanceOverrides, computePalmPose, computePalmWidth, computePinch, computeSpread, createHandMaterial, decanonicalizeComponentValue, despawnPrefab, encodeOverride, estimateHandScale, findSnapshotRootEntityIds, findTopLevelNestedRegions, groupOverridePaths, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadPrefab, matchHandPose, mergeComponentValue, parseOverride, parsePrefabAsset, prefabFileVersionFor, readXrCapabilities, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, setPrefabAssetUrlResolver, spawnPrefab } from './chunk-7SSOZWXM.js';
3
- import { registerDefaultFactories } from './chunk-KRWBNC6Y.js';
4
- export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './chunk-KRWBNC6Y.js';
5
- import { ObjectManagementSystem } from './chunk-PFE2SDXR.js';
6
- export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-PFE2SDXR.js';
7
- import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-J3EUNW57.js';
8
- export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-J3EUNW57.js';
1
+ import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-CDSE7476.js';
2
+ export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, AnimationSystem, AudioSystem, Behaviour, CURLED_COS, CameraSyncSystem, DEFAULT_DIRECTION_TOLERANCE, DEFAULT_ENTER_CONFIDENCE, DEFAULT_EXIT_CONFIDENCE, DEFAULT_LOST_GRACE_SECONDS, DEFAULT_MIN_HOLD_SECONDS, EnvironmentSyncSystem, FALLBACK_HAND_SCALE, HYDRATABLE_ENTITY_KINDS, HandPoseTracker, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MATCH_FALLOFF, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, MaterialSyncSystem, MeshGeometrySystem, NODE_KEY_SEPARATOR, NO_XR_CAPABILITIES, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectVisibilitySystem, PINCH_FINGERS, PREFAB_FILE_VERSION, PREFAB_FILE_VERSION_NESTED, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, STRAIGHT_COS, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, TeleportAimGate, ThrowVelocityTracker, TransformSyncSystem, VELOCITY_SAMPLES, VRTeleportAreaSystem, VideoSystem, XRControllerVisualSystem, XRHandPoseSystem, XRHoverVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, XR_HOVER_SHELL_FLAG, angularVelocityFrom, applyHandMaterial, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearPrefabCache, collectDiffPaths, collectEntitySubtree, collectSnapshotSubtreeIds, computeFingerCurl, computeHandShape, computeInstanceOverrides, computePalmPose, computePalmWidth, computePinch, computeSpread, createHandMaterial, decanonicalizeComponentValue, despawnPrefab, encodeOverride, estimateHandScale, findSnapshotRootEntityIds, findTopLevelNestedRegions, groupOverridePaths, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadPrefab, matchHandPose, mergeComponentValue, parseOverride, parsePrefabAsset, prefabFileVersionFor, readXrCapabilities, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, setPrefabAssetUrlResolver, spawnPrefab } from './chunk-CDSE7476.js';
3
+ import { registerDefaultFactories } from './chunk-P42OE3RU.js';
4
+ export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './chunk-P42OE3RU.js';
5
+ import { ObjectManagementSystem } from './chunk-D6KXWNYT.js';
6
+ export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-D6KXWNYT.js';
7
+ import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-H6DQ7JRE.js';
8
+ export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-H6DQ7JRE.js';
9
9
  import './chunk-QHILSPT4.js';
10
10
  import { normalizeDebugValue, DEBUG_CHANGE_IGNORED_SYSTEMS, cloneHistoryValue } from './chunk-OWQSESTO.js';
11
11
  import { __name } from './chunk-OY7ZODZP.js';
@@ -2298,15 +2298,22 @@ function getHandPosePreset(id) {
2298
2298
  return cloneHandPose(preset);
2299
2299
  }
2300
2300
  __name(getHandPosePreset, "getHandPosePreset");
2301
+ function cloneTarget(target) {
2302
+ return {
2303
+ ...target,
2304
+ ...target.directions ? { directions: [...target.directions] } : {}
2305
+ };
2306
+ }
2307
+ __name(cloneTarget, "cloneTarget");
2301
2308
  function cloneHandPose(definition) {
2302
2309
  return {
2303
2310
  ...definition,
2304
2311
  fingers: {
2305
- thumb: { ...definition.fingers.thumb },
2306
- index: { ...definition.fingers.index },
2307
- middle: { ...definition.fingers.middle },
2308
- ring: { ...definition.fingers.ring },
2309
- pinky: { ...definition.fingers.pinky }
2312
+ thumb: cloneTarget(definition.fingers.thumb),
2313
+ index: cloneTarget(definition.fingers.index),
2314
+ middle: cloneTarget(definition.fingers.middle),
2315
+ ring: cloneTarget(definition.fingers.ring),
2316
+ pinky: cloneTarget(definition.fingers.pinky)
2310
2317
  },
2311
2318
  pinch: definition.pinch ? { ...definition.pinch } : void 0,
2312
2319
  orientation: definition.orientation ? { ...definition.orientation } : void 0
@@ -2315,22 +2322,27 @@ function cloneHandPose(definition) {
2315
2322
  __name(cloneHandPose, "cloneHandPose");
2316
2323
  function handPoseFromCurls(id, name, curls, options) {
2317
2324
  const tolerance = options?.tolerance ?? NARROW;
2318
- const target = /* @__PURE__ */ __name((curl) => ({
2319
- curl: Math.min(1, Math.max(0, curl)),
2320
- tolerance
2321
- }), "target");
2325
+ const target = /* @__PURE__ */ __name((finger, curl) => {
2326
+ const directions = options?.directions?.[finger];
2327
+ return {
2328
+ curl: Math.min(1, Math.max(0, curl)),
2329
+ tolerance,
2330
+ ...directions && directions.length > 0 ? { directions } : {}
2331
+ };
2332
+ }, "target");
2322
2333
  return {
2323
2334
  id,
2324
2335
  name,
2325
2336
  fingers: {
2326
- thumb: target(curls.thumb),
2327
- index: target(curls.index),
2328
- middle: target(curls.middle),
2329
- ring: target(curls.ring),
2330
- pinky: target(curls.pinky)
2337
+ thumb: target("thumb", curls.thumb),
2338
+ index: target("index", curls.index),
2339
+ middle: target("middle", curls.middle),
2340
+ ring: target("ring", curls.ring),
2341
+ pinky: target("pinky", curls.pinky)
2331
2342
  },
2332
2343
  pinch: options?.pinch,
2333
2344
  orientation: options?.orientation,
2345
+ directionToleranceDegrees: options?.directionToleranceDegrees,
2334
2346
  hand: options?.hand
2335
2347
  };
2336
2348
  }
@@ -2351,6 +2363,14 @@ function createHandPoseEntry(partial) {
2351
2363
  preset: partial.preset ?? null,
2352
2364
  curls: { ...DEFAULT_POSE_CURLS, ...partial.curls },
2353
2365
  tolerance: partial.tolerance ?? 0.25,
2366
+ directions: {
2367
+ thumb: [...partial.directions?.thumb ?? []],
2368
+ index: [...partial.directions?.index ?? []],
2369
+ middle: [...partial.directions?.middle ?? []],
2370
+ ring: [...partial.directions?.ring ?? []],
2371
+ pinky: [...partial.directions?.pinky ?? []]
2372
+ },
2373
+ directionTolerance: partial.directionTolerance ?? 45,
2354
2374
  hand: partial.hand ?? null,
2355
2375
  orientation: partial.orientation ?? null,
2356
2376
  minHoldSeconds: partial.minHoldSeconds ?? 0.15,
@@ -2373,7 +2393,9 @@ function handPoseDefinitionFor(entry, resolvePreset) {
2373
2393
  return handPoseFromCurls(entry.id, entry.name, entry.curls, {
2374
2394
  tolerance: entry.tolerance,
2375
2395
  orientation: entry.orientation ?? void 0,
2376
- hand: entry.hand ?? void 0
2396
+ hand: entry.hand ?? void 0,
2397
+ directions: entry.directions,
2398
+ directionToleranceDegrees: entry.directionTolerance
2377
2399
  });
2378
2400
  }
2379
2401
  __name(handPoseDefinitionFor, "handPoseDefinitionFor");
@@ -8310,6 +8332,25 @@ var _XRInputSystem = class _XRInputSystem {
8310
8332
  }
8311
8333
  return null;
8312
8334
  }
8335
+ /**
8336
+ * The ARTICULATED source for a hand — the one carrying joint poses.
8337
+ *
8338
+ * Distinct from {@link getInput} because a hand can be backed by several
8339
+ * sources at once: a Quest reports a controller AND a tracked hand for the
8340
+ * same handedness, and Vision Pro adds a transient pinch alongside its two
8341
+ * persistent hands. `getInput` returns whichever was seen first, so anything
8342
+ * needing JOINTS has to ask for them specifically — taking the first match
8343
+ * silently handed pose detection a controller with no joints, and no pose
8344
+ * ever fired.
8345
+ */
8346
+ getHandInput(handedness) {
8347
+ for (const record of this.records.values()) {
8348
+ const state = record.state;
8349
+ if (state.handedness !== handedness) continue;
8350
+ if (state.joints) return state;
8351
+ }
8352
+ return null;
8353
+ }
8313
8354
  /** True while ANY source is selecting — the portable "is the user acting" check. */
8314
8355
  isSelecting() {
8315
8356
  for (const record of this.records.values()) {
@@ -10340,10 +10381,22 @@ function computeHandShape(joints, handedness) {
10340
10381
  const direction = new THREE26__namespace.Vector3().subVectors(thumbTip, thumbBase);
10341
10382
  if (direction.lengthSq() > 1e-12) thumbDirection = direction.normalize();
10342
10383
  }
10384
+ const fingerDirections = {};
10385
+ for (const finger of XR_FINGERS) {
10386
+ const base = joints[METACARPAL_JOINTS[finger]];
10387
+ const tip = joints[TIP_JOINTS[finger]];
10388
+ if (!base || !tip) {
10389
+ fingerDirections[finger] = null;
10390
+ continue;
10391
+ }
10392
+ const direction = new THREE26__namespace.Vector3().subVectors(tip, base);
10393
+ fingerDirections[finger] = direction.lengthSq() > 1e-12 ? direction.normalize() : null;
10394
+ }
10343
10395
  return {
10344
10396
  handedness,
10345
10397
  fingers: fingers2,
10346
10398
  pinch,
10399
+ fingerDirections,
10347
10400
  spread: {
10348
10401
  thumbIndex: computeSpread(joints, "thumb", "index") ?? 0,
10349
10402
  indexMiddle: computeSpread(joints, "index", "middle") ?? 0,
@@ -10368,6 +10421,7 @@ function scoreAgainst(actual, target, tolerance) {
10368
10421
  return clamp01(1 - (error - tolerance) / MATCH_FALLOFF);
10369
10422
  }
10370
10423
  __name(scoreAgainst, "scoreAgainst");
10424
+ var DEFAULT_DIRECTION_TOLERANCE = 45;
10371
10425
  var WORLD_DIRECTIONS = {
10372
10426
  up: new THREE26__namespace.Vector3(0, 1, 0),
10373
10427
  down: new THREE26__namespace.Vector3(0, -1, 0),
@@ -10395,6 +10449,22 @@ function resolveDirection(direction, shape, context) {
10395
10449
  return direction === "toward-head" ? toHead : toHead.multiplyScalar(-1);
10396
10450
  }
10397
10451
  __name(resolveDirection, "resolveDirection");
10452
+ function scoreDirections(actual, accepted, shape, toleranceDegrees, context) {
10453
+ if (!actual) return 0;
10454
+ let best = 0;
10455
+ for (const direction of accepted) {
10456
+ const wanted = resolveDirection(direction, shape, context);
10457
+ if (!wanted) continue;
10458
+ const angle = THREE26__namespace.MathUtils.radToDeg(
10459
+ Math.acos(THREE26__namespace.MathUtils.clamp(actual.dot(wanted), -1, 1))
10460
+ );
10461
+ const normalizedError = Math.max(0, angle - toleranceDegrees) / 90;
10462
+ const score = clamp01(1 - normalizedError / MATCH_FALLOFF);
10463
+ if (score > best) best = score;
10464
+ }
10465
+ return best;
10466
+ }
10467
+ __name(scoreDirections, "scoreDirections");
10398
10468
  function matchHandPose(shape, definition, context) {
10399
10469
  if (definition.hand && definition.hand !== shape.handedness) return NO_MATCH;
10400
10470
  let confidence = 1;
@@ -10424,6 +10494,18 @@ function matchHandPose(shape, definition, context) {
10424
10494
  `${finger} tip`
10425
10495
  );
10426
10496
  }
10497
+ if (target.directions && target.directions.length > 0) {
10498
+ consider(
10499
+ scoreDirections(
10500
+ shape.fingerDirections[finger],
10501
+ target.directions,
10502
+ shape,
10503
+ definition.directionToleranceDegrees ?? DEFAULT_DIRECTION_TOLERANCE,
10504
+ context
10505
+ ),
10506
+ `${finger} direction`
10507
+ );
10508
+ }
10427
10509
  }
10428
10510
  if (definition.pinch) {
10429
10511
  const { finger, target, tolerance } = definition.pinch;
@@ -10520,6 +10602,8 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10520
10602
  /** Reused so head-relative orientation checks allocate nothing per frame. */
10521
10603
  this.headPosition = new THREE26__namespace.Vector3();
10522
10604
  this.elapsed = 0;
10605
+ this.warnedNoHands = false;
10606
+ this.noHandSeconds = 0;
10523
10607
  this.inputSystem = inputSystem;
10524
10608
  }
10525
10609
  update(world, deltaTime) {
@@ -10531,6 +10615,20 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10531
10615
  this.refreshShapes();
10532
10616
  const entries = this.collectEntries(world);
10533
10617
  if (entries.length === 0) return;
10618
+ if (!this.warnedNoHands) {
10619
+ const tracked = this.shapes.get("left") !== null || this.shapes.get("right") !== null;
10620
+ if (tracked) {
10621
+ this.warnedNoHands = true;
10622
+ } else {
10623
+ this.noHandSeconds += deltaTime;
10624
+ if (this.noHandSeconds > 5) {
10625
+ this.warnedNoHands = true;
10626
+ console.warn(
10627
+ "[XRHandPoseSystem] Hand poses are configured but no tracked hands have been seen. Hand poses need HAND TRACKING \u2014 put the controllers down and enable hand tracking on the headset."
10628
+ );
10629
+ }
10630
+ }
10631
+ }
10534
10632
  world.getCamera().getWorldPosition(this.headPosition);
10535
10633
  const context = { headPosition: this.headPosition };
10536
10634
  for (const { entityId, entry } of entries) {
@@ -10575,7 +10673,7 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10575
10673
  /** Derive each hand's shape once for the whole frame. */
10576
10674
  refreshShapes() {
10577
10675
  for (const handedness of ["left", "right"]) {
10578
- const input = this.inputSystem.getInput(handedness);
10676
+ const input = this.inputSystem.getHandInput(handedness);
10579
10677
  const joints = input?.joints ?? null;
10580
10678
  this.shapes.set(
10581
10679
  handedness,