@relu-interactives/spatial-ecs 0.3.18 → 0.3.19
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/dist/{XRHandPose-B8xxFb9A.d.cts → XRHandPose-CLl4MiHx.d.cts} +12 -2
- package/dist/{XRHandPose-ubMe5Igc.d.ts → XRHandPose-CrzI57JA.d.ts} +12 -2
- package/dist/{chunk-PFE2SDXR.js → chunk-D6KXWNYT.js} +3 -3
- package/dist/{chunk-PFE2SDXR.js.map → chunk-D6KXWNYT.js.map} +1 -1
- package/dist/{chunk-J3EUNW57.js → chunk-H6DQ7JRE.js} +48 -18
- package/dist/chunk-H6DQ7JRE.js.map +1 -0
- package/dist/{chunk-7SSOZWXM.js → chunk-JYKFLQB5.js} +46 -5
- package/dist/chunk-JYKFLQB5.js.map +1 -0
- package/dist/{chunk-KRWBNC6Y.js → chunk-P42OE3RU.js} +4 -4
- package/dist/{chunk-KRWBNC6Y.js.map → chunk-P42OE3RU.js.map} +1 -1
- package/dist/components/index.cjs +33 -10
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/vr-and-hand-poses.md +67 -0
- package/dist/factories/index.cjs +8 -0
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +3 -3
- package/dist/{handPose-dFxqbFFY.d.cts → handPose-DlcTtqgx.d.cts} +26 -1
- package/dist/{handPose-dFxqbFFY.d.ts → handPose-DlcTtqgx.d.ts} +26 -1
- package/dist/{index-7CFf45fo.d.cts → index-3pNbH0iP.d.cts} +1 -1
- package/dist/{index-D7aSZ-e9.d.ts → index-C_589fc4.d.ts} +1 -1
- package/dist/{index-DhWfxUgL.d.ts → index-JRcoel9F.d.ts} +3 -2
- package/dist/{index-CA9fqh4Z.d.cts → index-g777AmFv.d.cts} +3 -2
- package/dist/index.cjs +87 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +78 -15
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.ts +2 -2
- package/dist/systems/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7SSOZWXM.js.map +0 -1
- 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,
|
|
5
|
-
export {
|
|
6
|
-
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-
|
|
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-
|
|
8
|
-
export { i as CoreComponents } from './index-
|
|
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-3pNbH0iP.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-3pNbH0iP.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-
|
|
12
|
-
export { C as CURLED_COS, D as DEFAULT_ENTER_CONFIDENCE,
|
|
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,
|
|
5
|
-
export {
|
|
6
|
-
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-
|
|
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-
|
|
8
|
-
export { i as CoreComponents } from './index-
|
|
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-C_589fc4.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-C_589fc4.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-
|
|
12
|
-
export { C as CURLED_COS, D as DEFAULT_ENTER_CONFIDENCE,
|
|
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-
|
|
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-
|
|
3
|
-
import { registerDefaultFactories } from './chunk-
|
|
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-
|
|
5
|
-
import { ObjectManagementSystem } from './chunk-
|
|
6
|
-
export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-
|
|
7
|
-
import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-
|
|
8
|
-
export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-
|
|
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-JYKFLQB5.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-JYKFLQB5.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';
|
package/dist/systems/index.cjs
CHANGED
|
@@ -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:
|
|
2306
|
-
index:
|
|
2307
|
-
middle:
|
|
2308
|
-
ring:
|
|
2309
|
-
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
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
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");
|
|
@@ -10340,10 +10362,22 @@ function computeHandShape(joints, handedness) {
|
|
|
10340
10362
|
const direction = new THREE26__namespace.Vector3().subVectors(thumbTip, thumbBase);
|
|
10341
10363
|
if (direction.lengthSq() > 1e-12) thumbDirection = direction.normalize();
|
|
10342
10364
|
}
|
|
10365
|
+
const fingerDirections = {};
|
|
10366
|
+
for (const finger of XR_FINGERS) {
|
|
10367
|
+
const base = joints[METACARPAL_JOINTS[finger]];
|
|
10368
|
+
const tip = joints[TIP_JOINTS[finger]];
|
|
10369
|
+
if (!base || !tip) {
|
|
10370
|
+
fingerDirections[finger] = null;
|
|
10371
|
+
continue;
|
|
10372
|
+
}
|
|
10373
|
+
const direction = new THREE26__namespace.Vector3().subVectors(tip, base);
|
|
10374
|
+
fingerDirections[finger] = direction.lengthSq() > 1e-12 ? direction.normalize() : null;
|
|
10375
|
+
}
|
|
10343
10376
|
return {
|
|
10344
10377
|
handedness,
|
|
10345
10378
|
fingers: fingers2,
|
|
10346
10379
|
pinch,
|
|
10380
|
+
fingerDirections,
|
|
10347
10381
|
spread: {
|
|
10348
10382
|
thumbIndex: computeSpread(joints, "thumb", "index") ?? 0,
|
|
10349
10383
|
indexMiddle: computeSpread(joints, "index", "middle") ?? 0,
|
|
@@ -10368,6 +10402,7 @@ function scoreAgainst(actual, target, tolerance) {
|
|
|
10368
10402
|
return clamp01(1 - (error - tolerance) / MATCH_FALLOFF);
|
|
10369
10403
|
}
|
|
10370
10404
|
__name(scoreAgainst, "scoreAgainst");
|
|
10405
|
+
var DEFAULT_DIRECTION_TOLERANCE = 45;
|
|
10371
10406
|
var WORLD_DIRECTIONS = {
|
|
10372
10407
|
up: new THREE26__namespace.Vector3(0, 1, 0),
|
|
10373
10408
|
down: new THREE26__namespace.Vector3(0, -1, 0),
|
|
@@ -10395,6 +10430,22 @@ function resolveDirection(direction, shape, context) {
|
|
|
10395
10430
|
return direction === "toward-head" ? toHead : toHead.multiplyScalar(-1);
|
|
10396
10431
|
}
|
|
10397
10432
|
__name(resolveDirection, "resolveDirection");
|
|
10433
|
+
function scoreDirections(actual, accepted, shape, toleranceDegrees, context) {
|
|
10434
|
+
if (!actual) return 0;
|
|
10435
|
+
let best = 0;
|
|
10436
|
+
for (const direction of accepted) {
|
|
10437
|
+
const wanted = resolveDirection(direction, shape, context);
|
|
10438
|
+
if (!wanted) continue;
|
|
10439
|
+
const angle = THREE26__namespace.MathUtils.radToDeg(
|
|
10440
|
+
Math.acos(THREE26__namespace.MathUtils.clamp(actual.dot(wanted), -1, 1))
|
|
10441
|
+
);
|
|
10442
|
+
const normalizedError = Math.max(0, angle - toleranceDegrees) / 90;
|
|
10443
|
+
const score = clamp01(1 - normalizedError / MATCH_FALLOFF);
|
|
10444
|
+
if (score > best) best = score;
|
|
10445
|
+
}
|
|
10446
|
+
return best;
|
|
10447
|
+
}
|
|
10448
|
+
__name(scoreDirections, "scoreDirections");
|
|
10398
10449
|
function matchHandPose(shape, definition, context) {
|
|
10399
10450
|
if (definition.hand && definition.hand !== shape.handedness) return NO_MATCH;
|
|
10400
10451
|
let confidence = 1;
|
|
@@ -10424,6 +10475,18 @@ function matchHandPose(shape, definition, context) {
|
|
|
10424
10475
|
`${finger} tip`
|
|
10425
10476
|
);
|
|
10426
10477
|
}
|
|
10478
|
+
if (target.directions && target.directions.length > 0) {
|
|
10479
|
+
consider(
|
|
10480
|
+
scoreDirections(
|
|
10481
|
+
shape.fingerDirections[finger],
|
|
10482
|
+
target.directions,
|
|
10483
|
+
shape,
|
|
10484
|
+
definition.directionToleranceDegrees ?? DEFAULT_DIRECTION_TOLERANCE,
|
|
10485
|
+
context
|
|
10486
|
+
),
|
|
10487
|
+
`${finger} direction`
|
|
10488
|
+
);
|
|
10489
|
+
}
|
|
10427
10490
|
}
|
|
10428
10491
|
if (definition.pinch) {
|
|
10429
10492
|
const { finger, target, tolerance } = definition.pinch;
|