@relu-interactives/spatial-ecs 0.3.17 → 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-LR4EhboN.d.cts → XRHandPose-CLl4MiHx.d.cts} +24 -2
- package/dist/{XRHandPose-SZ7ou63b.d.ts → XRHandPose-CrzI57JA.d.ts} +24 -2
- package/dist/{chunk-PNQ7HDQC.js → chunk-D6KXWNYT.js} +3 -3
- package/dist/{chunk-PNQ7HDQC.js.map → chunk-D6KXWNYT.js.map} +1 -1
- package/dist/{chunk-3LDQ4GVZ.js → chunk-H6DQ7JRE.js} +51 -18
- package/dist/chunk-H6DQ7JRE.js.map +1 -0
- package/dist/{chunk-CE2CPZSP.js → chunk-JYKFLQB5.js} +155 -36
- package/dist/chunk-JYKFLQB5.js.map +1 -0
- package/dist/{chunk-UHJ4MDIM.js → chunk-P42OE3RU.js} +4 -4
- package/dist/{chunk-UHJ4MDIM.js.map → chunk-P42OE3RU.js.map} +1 -1
- package/dist/components/index.cjs +36 -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 +68 -1
- package/dist/factories/index.cjs +11 -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-ekS4iypo.d.cts → index-3pNbH0iP.d.cts} +23 -2
- package/dist/{index-uKFxVCmr.d.ts → index-C_589fc4.d.ts} +23 -2
- package/dist/{index-ByiUoIoh.d.ts → index-JRcoel9F.d.ts} +3 -2
- package/dist/{index-BL5EWkwY.d.cts → index-g777AmFv.d.cts} +3 -2
- package/dist/index.cjs +199 -46
- 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 +190 -46
- 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-3LDQ4GVZ.js.map +0 -1
- package/dist/chunk-CE2CPZSP.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
|
@@ -2151,6 +2151,9 @@ var _XRRigComponent = class _XRRigComponent extends Component {
|
|
|
2151
2151
|
this.snapTurn = options?.snapTurn ?? true;
|
|
2152
2152
|
this.snapTurnDegrees = options?.snapTurnDegrees ?? 30;
|
|
2153
2153
|
this.fallbackEyeHeight = options?.fallbackEyeHeight ?? 1.6;
|
|
2154
|
+
this.teleportArcColor = options?.teleportArcColor ?? "#4da3ff";
|
|
2155
|
+
this.teleportArcInvalidColor = options?.teleportArcInvalidColor ?? "#ff5a5a";
|
|
2156
|
+
this.teleportArcThickness = options?.teleportArcThickness ?? 0.012;
|
|
2154
2157
|
}
|
|
2155
2158
|
};
|
|
2156
2159
|
__name(_XRRigComponent, "XRRigComponent");
|
|
@@ -2295,15 +2298,22 @@ function getHandPosePreset(id) {
|
|
|
2295
2298
|
return cloneHandPose(preset);
|
|
2296
2299
|
}
|
|
2297
2300
|
__name(getHandPosePreset, "getHandPosePreset");
|
|
2301
|
+
function cloneTarget(target) {
|
|
2302
|
+
return {
|
|
2303
|
+
...target,
|
|
2304
|
+
...target.directions ? { directions: [...target.directions] } : {}
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
__name(cloneTarget, "cloneTarget");
|
|
2298
2308
|
function cloneHandPose(definition) {
|
|
2299
2309
|
return {
|
|
2300
2310
|
...definition,
|
|
2301
2311
|
fingers: {
|
|
2302
|
-
thumb:
|
|
2303
|
-
index:
|
|
2304
|
-
middle:
|
|
2305
|
-
ring:
|
|
2306
|
-
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)
|
|
2307
2317
|
},
|
|
2308
2318
|
pinch: definition.pinch ? { ...definition.pinch } : void 0,
|
|
2309
2319
|
orientation: definition.orientation ? { ...definition.orientation } : void 0
|
|
@@ -2312,22 +2322,27 @@ function cloneHandPose(definition) {
|
|
|
2312
2322
|
__name(cloneHandPose, "cloneHandPose");
|
|
2313
2323
|
function handPoseFromCurls(id, name, curls, options) {
|
|
2314
2324
|
const tolerance = options?.tolerance ?? NARROW;
|
|
2315
|
-
const target = /* @__PURE__ */ __name((curl) =>
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
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");
|
|
2319
2333
|
return {
|
|
2320
2334
|
id,
|
|
2321
2335
|
name,
|
|
2322
2336
|
fingers: {
|
|
2323
|
-
thumb: target(curls.thumb),
|
|
2324
|
-
index: target(curls.index),
|
|
2325
|
-
middle: target(curls.middle),
|
|
2326
|
-
ring: target(curls.ring),
|
|
2327
|
-
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)
|
|
2328
2342
|
},
|
|
2329
2343
|
pinch: options?.pinch,
|
|
2330
2344
|
orientation: options?.orientation,
|
|
2345
|
+
directionToleranceDegrees: options?.directionToleranceDegrees,
|
|
2331
2346
|
hand: options?.hand
|
|
2332
2347
|
};
|
|
2333
2348
|
}
|
|
@@ -2348,6 +2363,14 @@ function createHandPoseEntry(partial) {
|
|
|
2348
2363
|
preset: partial.preset ?? null,
|
|
2349
2364
|
curls: { ...DEFAULT_POSE_CURLS, ...partial.curls },
|
|
2350
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,
|
|
2351
2374
|
hand: partial.hand ?? null,
|
|
2352
2375
|
orientation: partial.orientation ?? null,
|
|
2353
2376
|
minHoldSeconds: partial.minHoldSeconds ?? 0.15,
|
|
@@ -2370,7 +2393,9 @@ function handPoseDefinitionFor(entry, resolvePreset) {
|
|
|
2370
2393
|
return handPoseFromCurls(entry.id, entry.name, entry.curls, {
|
|
2371
2394
|
tolerance: entry.tolerance,
|
|
2372
2395
|
orientation: entry.orientation ?? void 0,
|
|
2373
|
-
hand: entry.hand ?? void 0
|
|
2396
|
+
hand: entry.hand ?? void 0,
|
|
2397
|
+
directions: entry.directions,
|
|
2398
|
+
directionToleranceDegrees: entry.directionTolerance
|
|
2374
2399
|
});
|
|
2375
2400
|
}
|
|
2376
2401
|
__name(handPoseDefinitionFor, "handPoseDefinitionFor");
|
|
@@ -5361,6 +5386,15 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5361
5386
|
if (typeof sourceXrRig.snapTurnDegrees === "number") {
|
|
5362
5387
|
rig.snapTurnDegrees = sourceXrRig.snapTurnDegrees;
|
|
5363
5388
|
}
|
|
5389
|
+
if (typeof sourceXrRig.teleportArcColor === "string") {
|
|
5390
|
+
rig.teleportArcColor = sourceXrRig.teleportArcColor;
|
|
5391
|
+
}
|
|
5392
|
+
if (typeof sourceXrRig.teleportArcInvalidColor === "string") {
|
|
5393
|
+
rig.teleportArcInvalidColor = sourceXrRig.teleportArcInvalidColor;
|
|
5394
|
+
}
|
|
5395
|
+
if (typeof sourceXrRig.teleportArcThickness === "number") {
|
|
5396
|
+
rig.teleportArcThickness = sourceXrRig.teleportArcThickness;
|
|
5397
|
+
}
|
|
5364
5398
|
if (typeof sourceXrRig.fallbackEyeHeight === "number") {
|
|
5365
5399
|
rig.fallbackEyeHeight = sourceXrRig.fallbackEyeHeight;
|
|
5366
5400
|
}
|
|
@@ -9933,24 +9967,33 @@ __name(_XRControllerVisualSystem, "XRControllerVisualSystem");
|
|
|
9933
9967
|
var XRControllerVisualSystem = _XRControllerVisualSystem;
|
|
9934
9968
|
var MARKER_RADIUS = 0.28;
|
|
9935
9969
|
var ACCENT = new THREE26__namespace.Color("#4da3ff");
|
|
9936
|
-
var
|
|
9970
|
+
var SEGMENT_AXIS = new THREE26__namespace.Vector3(0, 1, 0);
|
|
9971
|
+
var HEAD_CLEARANCE = 0.25;
|
|
9937
9972
|
var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
|
|
9938
9973
|
constructor(locomotionSystem) {
|
|
9939
9974
|
this.group = new THREE26__namespace.Group();
|
|
9940
|
-
|
|
9975
|
+
/** Holds the segment chain that draws the arc. */
|
|
9976
|
+
this.arc = new THREE26__namespace.Group();
|
|
9977
|
+
/**
|
|
9978
|
+
* Unit cylinder along +Y, reused by every segment.
|
|
9979
|
+
*
|
|
9980
|
+
* The arc was a `THREE.Line`, which WebGL always renders one pixel wide —
|
|
9981
|
+
* effectively invisible on a headset, and not thickenable at all. A chain of
|
|
9982
|
+
* scaled cylinders gives real thickness while rebuilding no geometry: each
|
|
9983
|
+
* frame only moves, rotates and scales meshes that already exist.
|
|
9984
|
+
*/
|
|
9985
|
+
this.segmentGeometry = new THREE26__namespace.CylinderGeometry(1, 1, 1, 6, 1);
|
|
9986
|
+
this.segments = [];
|
|
9941
9987
|
this.marker = new THREE26__namespace.Group();
|
|
9942
9988
|
this.attached = false;
|
|
9989
|
+
this.scratchDirection = new THREE26__namespace.Vector3();
|
|
9990
|
+
this.scratchHead = new THREE26__namespace.Vector3();
|
|
9991
|
+
this.validColor = new THREE26__namespace.Color();
|
|
9992
|
+
this.invalidColor = new THREE26__namespace.Color();
|
|
9943
9993
|
this.locomotionSystem = locomotionSystem;
|
|
9944
9994
|
this.group.name = "XRTeleportVisuals";
|
|
9945
9995
|
this.group.userData.ecsPreviewHidden = true;
|
|
9946
|
-
|
|
9947
|
-
vertexColors: true,
|
|
9948
|
-
transparent: true,
|
|
9949
|
-
depthTest: false
|
|
9950
|
-
});
|
|
9951
|
-
this.arc = new THREE26__namespace.Line(this.arcGeometry, arcMaterial);
|
|
9952
|
-
this.arc.frustumCulled = false;
|
|
9953
|
-
this.arc.renderOrder = 998;
|
|
9996
|
+
this.arc.name = "XRTeleportArc";
|
|
9954
9997
|
this.group.add(this.arc);
|
|
9955
9998
|
this.marker.add(this.createRing(), this.createDot());
|
|
9956
9999
|
this.marker.renderOrder = 999;
|
|
@@ -9962,15 +10005,27 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
|
|
|
9962
10005
|
world.getScene().add(this.group);
|
|
9963
10006
|
this.attached = true;
|
|
9964
10007
|
}
|
|
9965
|
-
const
|
|
10008
|
+
const raw = this.locomotionSystem.getAimCurve();
|
|
9966
10009
|
const landing = this.locomotionSystem.getLandingPoint();
|
|
9967
10010
|
const valid = this.locomotionSystem.isAimValid();
|
|
10011
|
+
if (raw.length < 2) {
|
|
10012
|
+
this.setVisible(false);
|
|
10013
|
+
return;
|
|
10014
|
+
}
|
|
10015
|
+
const curve = this.trimNearHead(world, raw);
|
|
9968
10016
|
if (curve.length < 2) {
|
|
9969
10017
|
this.setVisible(false);
|
|
9970
10018
|
return;
|
|
9971
10019
|
}
|
|
9972
|
-
this.
|
|
10020
|
+
const rig = this.resolveRig(world);
|
|
10021
|
+
const thickness = Math.min(
|
|
10022
|
+
0.1,
|
|
10023
|
+
Math.max(1e-3, rig?.teleportArcThickness ?? 0.012)
|
|
10024
|
+
);
|
|
10025
|
+
const tint = valid ? this.validColor.set(rig?.teleportArcColor ?? "#4da3ff") : this.invalidColor.set(rig?.teleportArcInvalidColor ?? "#ff5a5a");
|
|
10026
|
+
this.updateArcGeometry(curve, tint, thickness);
|
|
9973
10027
|
if (valid && landing) {
|
|
10028
|
+
this.tintMarker(tint);
|
|
9974
10029
|
this.marker.position.copy(landing);
|
|
9975
10030
|
this.marker.position.y += 0.01;
|
|
9976
10031
|
this.marker.visible = true;
|
|
@@ -9979,27 +10034,66 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
|
|
|
9979
10034
|
}
|
|
9980
10035
|
this.setVisible(true);
|
|
9981
10036
|
}
|
|
9982
|
-
updateArcGeometry(curve, tint) {
|
|
9983
|
-
const
|
|
9984
|
-
|
|
9985
|
-
const
|
|
9986
|
-
for (let i = 0; i <
|
|
9987
|
-
const
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
10037
|
+
updateArcGeometry(curve, tint, thickness) {
|
|
10038
|
+
const needed = curve.length - 1;
|
|
10039
|
+
this.ensureSegments(needed);
|
|
10040
|
+
const radius = thickness / 2;
|
|
10041
|
+
for (let i = 0; i < this.segments.length; i += 1) {
|
|
10042
|
+
const segment = this.segments[i];
|
|
10043
|
+
if (i >= needed) {
|
|
10044
|
+
segment.visible = false;
|
|
10045
|
+
continue;
|
|
10046
|
+
}
|
|
10047
|
+
const from = curve[i];
|
|
10048
|
+
const to = curve[i + 1];
|
|
10049
|
+
this.scratchDirection.subVectors(to, from);
|
|
10050
|
+
const length = this.scratchDirection.length();
|
|
10051
|
+
if (length < 1e-6) {
|
|
10052
|
+
segment.visible = false;
|
|
10053
|
+
continue;
|
|
10054
|
+
}
|
|
10055
|
+
segment.visible = true;
|
|
10056
|
+
segment.position.copy(from).addScaledVector(this.scratchDirection, 0.5);
|
|
10057
|
+
segment.quaternion.setFromUnitVectors(
|
|
10058
|
+
SEGMENT_AXIS,
|
|
10059
|
+
this.scratchDirection.divideScalar(length)
|
|
10060
|
+
);
|
|
10061
|
+
segment.scale.set(radius, length, radius);
|
|
10062
|
+
const t = needed > 1 ? i / (needed - 1) : 0;
|
|
9992
10063
|
const fade = 1 - t * 0.75;
|
|
9993
|
-
|
|
9994
|
-
colors[i * 3 + 1] = tint.g * fade;
|
|
9995
|
-
colors[i * 3 + 2] = tint.b * fade;
|
|
10064
|
+
segment.material.color.copy(tint).multiplyScalar(fade);
|
|
9996
10065
|
}
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
)
|
|
10001
|
-
|
|
10002
|
-
|
|
10066
|
+
}
|
|
10067
|
+
/** Grow the segment pool to cover the current arc. */
|
|
10068
|
+
ensureSegments(count) {
|
|
10069
|
+
while (this.segments.length < count) {
|
|
10070
|
+
const material = new THREE26__namespace.MeshBasicMaterial({
|
|
10071
|
+
transparent: true,
|
|
10072
|
+
depthTest: false,
|
|
10073
|
+
depthWrite: false
|
|
10074
|
+
});
|
|
10075
|
+
const mesh = new THREE26__namespace.Mesh(this.segmentGeometry, material);
|
|
10076
|
+
mesh.frustumCulled = false;
|
|
10077
|
+
mesh.renderOrder = 998;
|
|
10078
|
+
mesh.raycast = () => {
|
|
10079
|
+
};
|
|
10080
|
+
this.segments.push(mesh);
|
|
10081
|
+
this.arc.add(mesh);
|
|
10082
|
+
}
|
|
10083
|
+
}
|
|
10084
|
+
/** Drop leading points that sit too close to the viewer's head. */
|
|
10085
|
+
trimNearHead(world, curve) {
|
|
10086
|
+
world.getCamera().getWorldPosition(this.scratchHead);
|
|
10087
|
+
let start = 0;
|
|
10088
|
+
while (start < curve.length - 2 && curve[start].distanceTo(this.scratchHead) < HEAD_CLEARANCE) {
|
|
10089
|
+
start += 1;
|
|
10090
|
+
}
|
|
10091
|
+
return start === 0 ? curve : curve.slice(start);
|
|
10092
|
+
}
|
|
10093
|
+
resolveRig(world) {
|
|
10094
|
+
const entityId = world.query(XRRigComponent)[0];
|
|
10095
|
+
if (typeof entityId !== "number") return null;
|
|
10096
|
+
return world.getComponent(entityId, XRRigComponent) ?? null;
|
|
10003
10097
|
}
|
|
10004
10098
|
createRing() {
|
|
10005
10099
|
const geometry = new THREE26__namespace.RingGeometry(
|
|
@@ -10033,6 +10127,15 @@ var _XRTeleportVisualSystem = class _XRTeleportVisualSystem {
|
|
|
10033
10127
|
})
|
|
10034
10128
|
);
|
|
10035
10129
|
}
|
|
10130
|
+
/** Recolour the landing marker to match the arc. */
|
|
10131
|
+
tintMarker(color) {
|
|
10132
|
+
this.marker.traverse((child) => {
|
|
10133
|
+
const material = child.material;
|
|
10134
|
+
if (material && !Array.isArray(material)) {
|
|
10135
|
+
material.color?.copy(color);
|
|
10136
|
+
}
|
|
10137
|
+
});
|
|
10138
|
+
}
|
|
10036
10139
|
setVisible(visible) {
|
|
10037
10140
|
this.group.visible = visible;
|
|
10038
10141
|
}
|
|
@@ -10259,10 +10362,22 @@ function computeHandShape(joints, handedness) {
|
|
|
10259
10362
|
const direction = new THREE26__namespace.Vector3().subVectors(thumbTip, thumbBase);
|
|
10260
10363
|
if (direction.lengthSq() > 1e-12) thumbDirection = direction.normalize();
|
|
10261
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
|
+
}
|
|
10262
10376
|
return {
|
|
10263
10377
|
handedness,
|
|
10264
10378
|
fingers: fingers2,
|
|
10265
10379
|
pinch,
|
|
10380
|
+
fingerDirections,
|
|
10266
10381
|
spread: {
|
|
10267
10382
|
thumbIndex: computeSpread(joints, "thumb", "index") ?? 0,
|
|
10268
10383
|
indexMiddle: computeSpread(joints, "index", "middle") ?? 0,
|
|
@@ -10287,6 +10402,7 @@ function scoreAgainst(actual, target, tolerance) {
|
|
|
10287
10402
|
return clamp01(1 - (error - tolerance) / MATCH_FALLOFF);
|
|
10288
10403
|
}
|
|
10289
10404
|
__name(scoreAgainst, "scoreAgainst");
|
|
10405
|
+
var DEFAULT_DIRECTION_TOLERANCE = 45;
|
|
10290
10406
|
var WORLD_DIRECTIONS = {
|
|
10291
10407
|
up: new THREE26__namespace.Vector3(0, 1, 0),
|
|
10292
10408
|
down: new THREE26__namespace.Vector3(0, -1, 0),
|
|
@@ -10314,6 +10430,22 @@ function resolveDirection(direction, shape, context) {
|
|
|
10314
10430
|
return direction === "toward-head" ? toHead : toHead.multiplyScalar(-1);
|
|
10315
10431
|
}
|
|
10316
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");
|
|
10317
10449
|
function matchHandPose(shape, definition, context) {
|
|
10318
10450
|
if (definition.hand && definition.hand !== shape.handedness) return NO_MATCH;
|
|
10319
10451
|
let confidence = 1;
|
|
@@ -10343,6 +10475,18 @@ function matchHandPose(shape, definition, context) {
|
|
|
10343
10475
|
`${finger} tip`
|
|
10344
10476
|
);
|
|
10345
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
|
+
}
|
|
10346
10490
|
}
|
|
10347
10491
|
if (definition.pinch) {
|
|
10348
10492
|
const { finger, target, tolerance } = definition.pinch;
|