@relu-interactives/spatial-ecs 0.3.12 → 0.3.14

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 (45) hide show
  1. package/dist/{System-31wk-A0g.d.cts → System-BhnLw0fZ.d.cts} +7 -0
  2. package/dist/{System-31wk-A0g.d.ts → System-BhnLw0fZ.d.ts} +7 -0
  3. package/dist/{XRHandPose-DawOR0uR.d.cts → XRHandPose-LR4EhboN.d.cts} +25 -9
  4. package/dist/{XRHandPose-DhAd9Qi6.d.ts → XRHandPose-SZ7ou63b.d.ts} +25 -9
  5. package/dist/{chunk-OMDYLFTN.js → chunk-3LDQ4GVZ.js} +5 -5
  6. package/dist/chunk-3LDQ4GVZ.js.map +1 -0
  7. package/dist/{chunk-7ZIN6TGT.js → chunk-PNQ7HDQC.js} +3 -3
  8. package/dist/{chunk-7ZIN6TGT.js.map → chunk-PNQ7HDQC.js.map} +1 -1
  9. package/dist/{chunk-ID7U4FER.js → chunk-UHJ4MDIM.js} +7 -4
  10. package/dist/chunk-UHJ4MDIM.js.map +1 -0
  11. package/dist/{chunk-LCJ6IH2O.js → chunk-XHMOFI3Q.js} +104 -16
  12. package/dist/chunk-XHMOFI3Q.js.map +1 -0
  13. package/dist/components/index.cjs +3 -3
  14. package/dist/components/index.cjs.map +1 -1
  15. package/dist/components/index.d.cts +3 -3
  16. package/dist/components/index.d.ts +3 -3
  17. package/dist/components/index.js +1 -1
  18. package/dist/docs/guide/vr-and-hand-poses.md +5 -3
  19. package/dist/factories/index.cjs +6 -3
  20. package/dist/factories/index.cjs.map +1 -1
  21. package/dist/factories/index.d.cts +2 -2
  22. package/dist/factories/index.d.ts +2 -2
  23. package/dist/factories/index.js +3 -3
  24. package/dist/{index-Xm3im4Pt.d.cts → index-BL5EWkwY.d.cts} +2 -2
  25. package/dist/{index-B49322Q3.d.ts → index-ByiUoIoh.d.ts} +2 -2
  26. package/dist/{index-DJ9bn9SF.d.cts → index-CbrjAm_8.d.cts} +23 -1
  27. package/dist/{index-M0I5B3JA.d.ts → index-CvIXdHzx.d.ts} +23 -1
  28. package/dist/index.cjs +106 -14
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +45 -8
  31. package/dist/index.d.ts +45 -8
  32. package/dist/index.js +8 -8
  33. package/dist/systems/index.cjs +102 -14
  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/dist/types.d.cts +1 -1
  39. package/dist/types.d.ts +1 -1
  40. package/dist/worldSnapshotUtils.d.cts +1 -1
  41. package/dist/worldSnapshotUtils.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-ID7U4FER.js.map +0 -1
  44. package/dist/chunk-LCJ6IH2O.js.map +0 -1
  45. package/dist/chunk-OMDYLFTN.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
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-31wk-A0g.cjs';
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-31wk-A0g.cjs';
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
+ 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-DawOR0uR.cjs';
5
- export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-DawOR0uR.cjs';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-DJ9bn9SF.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-DJ9bn9SF.cjs';
8
- export { i as CoreComponents } from './index-Xm3im4Pt.cjs';
4
+ import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-LR4EhboN.cjs';
5
+ export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-LR4EhboN.cjs';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-CbrjAm_8.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-CbrjAm_8.cjs';
8
+ export { i as CoreComponents } from './index-BL5EWkwY.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
11
  import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.cjs';
@@ -807,6 +807,43 @@ declare function sampleTeleportArc(origin: THREE.Vector3, direction: THREE.Vecto
807
807
  */
808
808
  declare function arcGroundCrossing(points: THREE.Vector3[], groundY: number): THREE.Vector3 | null;
809
809
 
810
+ /**
811
+ * Decides when a teleport may actually commit.
812
+ *
813
+ * Teleport commits on RELEASE so the user can cancel by aiming away — the
814
+ * standard interaction. The trap is that a release edge alone is not evidence
815
+ * of intent: on hand tracking the SAME pinch drives grabbing, so the release
816
+ * that drops an object looks identical to the release that ends a teleport aim.
817
+ * Without this gate, letting go of a grabbed object teleports the player
818
+ * whenever the arc happens to land somewhere valid — and passing an object
819
+ * between hands does it too.
820
+ *
821
+ * The rule is simply: a release only commits if this source engaged an aim
822
+ * first, and going busy (grabbing) discards any aim it had engaged.
823
+ *
824
+ * Keyed per input source so the two hands are independent.
825
+ */
826
+ declare class TeleportAimGate {
827
+ private readonly aiming;
828
+ /**
829
+ * Feed one frame for one source.
830
+ *
831
+ * @returns whether the teleport should commit this frame.
832
+ */
833
+ update(source: object, aiming: boolean, releasing: boolean): boolean;
834
+ /** True if this source currently has an aim engaged. */
835
+ isAiming(source: object): boolean;
836
+ /**
837
+ * Drop a source's aim without committing.
838
+ *
839
+ * Called when a hand starts interacting, so the release that ends the grab
840
+ * cannot cash in an aim engaged before it.
841
+ *
842
+ * @returns whether an aim was actually discarded.
843
+ */
844
+ cancel(source: object): boolean;
845
+ }
846
+
810
847
  /**
811
848
  * Materials for tracked-hand meshes.
812
849
  *
@@ -928,4 +965,4 @@ declare class ThrowVelocityTracker {
928
965
  */
929
966
  declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
930
967
 
931
- 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
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-31wk-A0g.js';
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-31wk-A0g.js';
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
+ 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-DhAd9Qi6.js';
5
- export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-DhAd9Qi6.js';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-M0I5B3JA.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-M0I5B3JA.js';
8
- export { i as CoreComponents } from './index-B49322Q3.js';
4
+ import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-SZ7ou63b.js';
5
+ export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-SZ7ou63b.js';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-CvIXdHzx.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-CvIXdHzx.js';
8
+ export { i as CoreComponents } from './index-ByiUoIoh.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
11
  import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.js';
@@ -807,6 +807,43 @@ declare function sampleTeleportArc(origin: THREE.Vector3, direction: THREE.Vecto
807
807
  */
808
808
  declare function arcGroundCrossing(points: THREE.Vector3[], groundY: number): THREE.Vector3 | null;
809
809
 
810
+ /**
811
+ * Decides when a teleport may actually commit.
812
+ *
813
+ * Teleport commits on RELEASE so the user can cancel by aiming away — the
814
+ * standard interaction. The trap is that a release edge alone is not evidence
815
+ * of intent: on hand tracking the SAME pinch drives grabbing, so the release
816
+ * that drops an object looks identical to the release that ends a teleport aim.
817
+ * Without this gate, letting go of a grabbed object teleports the player
818
+ * whenever the arc happens to land somewhere valid — and passing an object
819
+ * between hands does it too.
820
+ *
821
+ * The rule is simply: a release only commits if this source engaged an aim
822
+ * first, and going busy (grabbing) discards any aim it had engaged.
823
+ *
824
+ * Keyed per input source so the two hands are independent.
825
+ */
826
+ declare class TeleportAimGate {
827
+ private readonly aiming;
828
+ /**
829
+ * Feed one frame for one source.
830
+ *
831
+ * @returns whether the teleport should commit this frame.
832
+ */
833
+ update(source: object, aiming: boolean, releasing: boolean): boolean;
834
+ /** True if this source currently has an aim engaged. */
835
+ isAiming(source: object): boolean;
836
+ /**
837
+ * Drop a source's aim without committing.
838
+ *
839
+ * Called when a hand starts interacting, so the release that ends the grab
840
+ * cannot cash in an aim engaged before it.
841
+ *
842
+ * @returns whether an aim was actually discarded.
843
+ */
844
+ cancel(source: object): boolean;
845
+ }
846
+
810
847
  /**
811
848
  * Materials for tracked-hand meshes.
812
849
  *
@@ -928,4 +965,4 @@ declare class ThrowVelocityTracker {
928
965
  */
929
966
  declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
930
967
 
931
- 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, 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 };
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 };
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-LCJ6IH2O.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, 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-LCJ6IH2O.js';
3
- import { registerDefaultFactories } from './chunk-ID7U4FER.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-ID7U4FER.js';
5
- import { ObjectManagementSystem } from './chunk-7ZIN6TGT.js';
6
- export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-7ZIN6TGT.js';
7
- import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-OMDYLFTN.js';
8
- export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-OMDYLFTN.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-XHMOFI3Q.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-XHMOFI3Q.js';
3
+ import { registerDefaultFactories } from './chunk-UHJ4MDIM.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-UHJ4MDIM.js';
5
+ import { ObjectManagementSystem } from './chunk-PNQ7HDQC.js';
6
+ export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-PNQ7HDQC.js';
7
+ import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-3LDQ4GVZ.js';
8
+ export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-3LDQ4GVZ.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';
@@ -2120,8 +2120,8 @@ var _XRInteractableComponent = class _XRInteractableComponent extends Component
2120
2120
  this.attachPoints = (options?.attachPoints ?? []).map(
2121
2121
  (point) => createAttachPoint(point)
2122
2122
  );
2123
- this.throwOnRelease = options?.throwOnRelease ?? true;
2124
- this.throwStrength = options?.throwStrength ?? 1;
2123
+ this.applyVelocityOnRelease = options?.applyVelocityOnRelease ?? true;
2124
+ this.velocityScale = options?.velocityScale ?? 1;
2125
2125
  this.hoverBehavior = options?.hoverBehavior ?? "color";
2126
2126
  this.hoverColor = options?.hoverColor ?? "#4da3ff";
2127
2127
  this.hoverScale = options?.hoverScale ?? 1.06;
@@ -2165,7 +2165,7 @@ var _XRInteractorComponent = class _XRInteractorComponent extends Component {
2165
2165
  this.handColor = options?.handColor ?? "#e8b48a";
2166
2166
  this.handOpacity = options?.handOpacity ?? 1;
2167
2167
  this.handEmissiveIntensity = options?.handEmissiveIntensity ?? 0;
2168
- this.showRay = options?.showRay ?? true;
2168
+ this.rayVisibility = options?.rayVisibility ?? "interacting";
2169
2169
  this.rayColor = options?.rayColor ?? "#4da3ff";
2170
2170
  this.rayThickness = options?.rayThickness ?? 6e-3;
2171
2171
  }
@@ -5438,11 +5438,15 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
5438
5438
  )
5439
5439
  );
5440
5440
  }
5441
- if (typeof sourceInteractable.throwOnRelease === "boolean") {
5442
- interactable.throwOnRelease = sourceInteractable.throwOnRelease;
5441
+ if (typeof sourceInteractable.applyVelocityOnRelease === "boolean") {
5442
+ interactable.applyVelocityOnRelease = sourceInteractable.applyVelocityOnRelease;
5443
+ } else if (typeof sourceInteractable.throwOnRelease === "boolean") {
5444
+ interactable.applyVelocityOnRelease = sourceInteractable.throwOnRelease;
5443
5445
  }
5444
- if (typeof sourceInteractable.throwStrength === "number") {
5445
- interactable.throwStrength = sourceInteractable.throwStrength;
5446
+ if (typeof sourceInteractable.velocityScale === "number") {
5447
+ interactable.velocityScale = sourceInteractable.velocityScale;
5448
+ } else if (typeof sourceInteractable.throwStrength === "number") {
5449
+ interactable.velocityScale = sourceInteractable.throwStrength;
5446
5450
  }
5447
5451
  const grabPos = asRecord3(sourceInteractable.grabOffsetPosition);
5448
5452
  if (grabPos) {
@@ -5518,8 +5522,10 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
5518
5522
  if (typeof sourceInteractor.handEmissiveIntensity === "number") {
5519
5523
  interactor.handEmissiveIntensity = sourceInteractor.handEmissiveIntensity;
5520
5524
  }
5521
- if (typeof sourceInteractor.showRay === "boolean") {
5522
- interactor.showRay = sourceInteractor.showRay;
5525
+ if (typeof sourceInteractor.rayVisibility === "string") {
5526
+ interactor.rayVisibility = sourceInteractor.rayVisibility;
5527
+ } else if (typeof sourceInteractor.showRay === "boolean") {
5528
+ interactor.rayVisibility = sourceInteractor.showRay ? "interacting" : "never";
5523
5529
  }
5524
5530
  if (typeof sourceInteractor.rayColor === "string") {
5525
5531
  interactor.rayColor = sourceInteractor.rayColor;
@@ -6326,6 +6332,7 @@ function hydrateWorldFromSnapshotDetailed(snapshot, world, objectManagementSyste
6326
6332
  isDefault: true
6327
6333
  };
6328
6334
  }
6335
+ payload.skipDefaultChildren = true;
6329
6336
  const createdEntityId = objectManagementSystem.createNow(kind, world, payload);
6330
6337
  idMap.set(sourceEntityId, createdEntityId);
6331
6338
  }
@@ -8959,8 +8966,8 @@ var _XRInteractionSystem = class _XRInteractionSystem {
8959
8966
  if (held.restoreBodyType !== null && physics) {
8960
8967
  physics.values.rigidbody.type = held.restoreBodyType;
8961
8968
  const dynamic = held.restoreBodyType === "dynamic";
8962
- if (dynamic && interactable?.throwOnRelease) {
8963
- const velocity = held.tracker.computeVelocity(this.elapsed).multiplyScalar(interactable.throwStrength);
8969
+ if (dynamic && interactable?.applyVelocityOnRelease) {
8970
+ const velocity = held.tracker.computeVelocity(this.elapsed).multiplyScalar(interactable.velocityScale);
8964
8971
  const spin = held.angularVelocity;
8965
8972
  setPhysicsLiveRef(physics, "pendingVelocity", {
8966
8973
  linear: { x: velocity.x, y: velocity.y, z: velocity.z },
@@ -9041,6 +9048,25 @@ var _XRInteractionSystem = class _XRInteractionSystem {
9041
9048
  isGrabbing() {
9042
9049
  return this.grabs.size > 0;
9043
9050
  }
9051
+ /**
9052
+ * Whether this hand's primary action is committed to interaction.
9053
+ *
9054
+ * True while the hand holds something, and also while it merely HOVERS a
9055
+ * grabbable — because the pinch that is about to grab must not be read as a
9056
+ * teleport by the locomotion system. Without the hover half, the first pinch
9057
+ * of a grab teleports the player, and so does the pinch that takes an object
9058
+ * from the other hand.
9059
+ */
9060
+ isHandBusy(world, handedness) {
9061
+ if (this.isGrabbingWith(handedness)) return true;
9062
+ const hover = this.getHoverFor(handedness);
9063
+ if (!hover) return false;
9064
+ const interactable = world.getComponent(
9065
+ hover.entityId,
9066
+ XRInteractableComponent
9067
+ );
9068
+ return Boolean(interactable?.enabled && interactable.grabbable);
9069
+ }
9044
9070
  /** True when THIS hand is holding something. */
9045
9071
  isGrabbingWith(handedness) {
9046
9072
  for (const input of this.grabs.keys()) {
@@ -9099,6 +9125,42 @@ function sampleTeleportArc(origin, direction, out = [], options) {
9099
9125
  }
9100
9126
  __name(sampleTeleportArc, "sampleTeleportArc");
9101
9127
 
9128
+ // core/xr/teleportAimGate.ts
9129
+ var _TeleportAimGate = class _TeleportAimGate {
9130
+ constructor() {
9131
+ this.aiming = /* @__PURE__ */ new WeakSet();
9132
+ }
9133
+ /**
9134
+ * Feed one frame for one source.
9135
+ *
9136
+ * @returns whether the teleport should commit this frame.
9137
+ */
9138
+ update(source, aiming, releasing) {
9139
+ const hadAim = this.aiming.has(source);
9140
+ if (aiming) this.aiming.add(source);
9141
+ if (!releasing) return false;
9142
+ this.aiming.delete(source);
9143
+ return hadAim;
9144
+ }
9145
+ /** True if this source currently has an aim engaged. */
9146
+ isAiming(source) {
9147
+ return this.aiming.has(source);
9148
+ }
9149
+ /**
9150
+ * Drop a source's aim without committing.
9151
+ *
9152
+ * Called when a hand starts interacting, so the release that ends the grab
9153
+ * cannot cash in an aim engaged before it.
9154
+ *
9155
+ * @returns whether an aim was actually discarded.
9156
+ */
9157
+ cancel(source) {
9158
+ return this.aiming.delete(source);
9159
+ }
9160
+ };
9161
+ __name(_TeleportAimGate, "TeleportAimGate");
9162
+ var TeleportAimGate = _TeleportAimGate;
9163
+
9102
9164
  // core/systems/XRLocomotionSystem.ts
9103
9165
  var UP = new THREE26__namespace.Vector3(0, 1, 0);
9104
9166
  var AXIS_DEADZONE = 0.5;
@@ -9116,10 +9178,24 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9116
9178
  this.aimValid = false;
9117
9179
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
9118
9180
  this.stickAiming = /* @__PURE__ */ new WeakSet();
9181
+ /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
9182
+ this.teleportAim = new TeleportAimGate();
9119
9183
  /** True once we've tried to self-heal camera parenting for this session. */
9120
9184
  this.parentingChecked = false;
9185
+ /**
9186
+ * Optional; when wired, hands busy grabbing are excluded from teleport.
9187
+ *
9188
+ * On hand tracking the SAME pinch drives both grabbing and teleport aiming,
9189
+ * so without this a user who picks something up is teleported at the same
9190
+ * moment.
9191
+ */
9192
+ this.interactionSystem = null;
9121
9193
  this.inputSystem = inputSystem;
9122
9194
  }
9195
+ /** Wire the interaction system so grabs suppress teleport on that hand. */
9196
+ setInteractionSystem(interactionSystem) {
9197
+ this.interactionSystem = interactionSystem;
9198
+ }
9123
9199
  update(world, deltaTime) {
9124
9200
  this.aimCurve = [];
9125
9201
  this.landingPoint = null;
@@ -9238,9 +9314,18 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9238
9314
  const targets = this.collectTeleportTargets(world);
9239
9315
  for (const input of inputs) {
9240
9316
  const source = input;
9317
+ if (input.handedness !== "none" && this.interactionSystem?.isHandBusy(world, input.handedness)) {
9318
+ if (this.teleportAim.cancel(source)) {
9319
+ this.aimCurve = [];
9320
+ this.landingPoint = null;
9321
+ this.aimValid = false;
9322
+ }
9323
+ continue;
9324
+ }
9241
9325
  const stick = this.readStickAim(input, source);
9242
9326
  const aiming = input.select || stick.aiming;
9243
- const commit = input.selectEnd || stick.released;
9327
+ const releasing = input.selectEnd || stick.released;
9328
+ const commit = this.teleportAim.update(source, aiming, releasing);
9244
9329
  if (!aiming && !commit) continue;
9245
9330
  const points = sampleTeleportArc(
9246
9331
  input.rayOrigin,
@@ -9713,9 +9798,12 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
9713
9798
  * clutter implying the whole scene is clickable.
9714
9799
  */
9715
9800
  shouldShowRay(interactor, side) {
9716
- if (interactor && !interactor.showRay) return false;
9801
+ const visibility = interactor?.rayVisibility ?? "interacting";
9802
+ if (visibility === "never") return false;
9803
+ if (visibility === "always") return true;
9717
9804
  if (!this.interactionSystem) return true;
9718
- return this.interactionSystem.getHoverFor(side) !== null || this.interactionSystem.isGrabbingWith(side);
9805
+ if (this.interactionSystem.isGrabbingWith(side)) return false;
9806
+ return this.interactionSystem.getHoverFor(side) !== null;
9719
9807
  }
9720
9808
  /** Push the author's ray colour and thickness onto the mesh. */
9721
9809
  applyRayStyle(ray, interactor) {