@relu-interactives/spatial-ecs 0.3.14 → 0.3.17

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/index.d.cts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-LR4EhboN.cjs';
5
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';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-ekS4iypo.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-ekS4iypo.cjs';
8
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';
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-SZ7ou63b.js';
5
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';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-uKFxVCmr.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-uKFxVCmr.js';
8
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';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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';
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-CE2CPZSP.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-CE2CPZSP.js';
3
3
  import { registerDefaultFactories } from './chunk-UHJ4MDIM.js';
4
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
5
  import { ObjectManagementSystem } from './chunk-PNQ7HDQC.js';
@@ -9049,17 +9049,22 @@ var _XRInteractionSystem = class _XRInteractionSystem {
9049
9049
  return this.grabs.size > 0;
9050
9050
  }
9051
9051
  /**
9052
- * Whether this hand's primary action is committed to interaction.
9052
+ * Whether this input's primary action is committed to interaction.
9053
9053
  *
9054
- * True while the hand holds something, and also while it merely HOVERS a
9054
+ * True while the source holds something, and also while it merely HOVERS a
9055
9055
  * grabbable — because the pinch that is about to grab must not be read as a
9056
9056
  * teleport by the locomotion system. Without the hover half, the first pinch
9057
9057
  * of a grab teleports the player, and so does the pinch that takes an object
9058
9058
  * from the other hand.
9059
+ *
9060
+ * Keyed on the INPUT SOURCE rather than handedness. Vision Pro reports
9061
+ * `handedness: "none"` for every gaze-pinch (it is hard-coded in WebKit), so a
9062
+ * handedness-keyed check silently never matched there and each pinch both
9063
+ * grabbed and teleported.
9059
9064
  */
9060
- isHandBusy(world, handedness) {
9061
- if (this.isGrabbingWith(handedness)) return true;
9062
- const hover = this.getHoverFor(handedness);
9065
+ isSourceBusy(world, input) {
9066
+ if (this.grabs.has(input)) return true;
9067
+ const hover = this.hovers.get(input);
9063
9068
  if (!hover) return false;
9064
9069
  const interactable = world.getComponent(
9065
9070
  hover.entityId,
@@ -9140,7 +9145,7 @@ var _TeleportAimGate = class _TeleportAimGate {
9140
9145
  if (aiming) this.aiming.add(source);
9141
9146
  if (!releasing) return false;
9142
9147
  this.aiming.delete(source);
9143
- return hadAim;
9148
+ return hadAim || aiming;
9144
9149
  }
9145
9150
  /** True if this source currently has an aim engaged. */
9146
9151
  isAiming(source) {
@@ -9178,6 +9183,8 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9178
9183
  this.aimValid = false;
9179
9184
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
9180
9185
  this.stickAiming = /* @__PURE__ */ new WeakSet();
9186
+ /** One-time warning when a committed teleport found nowhere to land. */
9187
+ this.warnedNoLanding = false;
9181
9188
  /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
9182
9189
  this.teleportAim = new TeleportAimGate();
9183
9190
  /** True once we've tried to self-heal camera parenting for this session. */
@@ -9314,7 +9321,7 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9314
9321
  const targets = this.collectTeleportTargets(world);
9315
9322
  for (const input of inputs) {
9316
9323
  const source = input;
9317
- if (input.handedness !== "none" && this.interactionSystem?.isHandBusy(world, input.handedness)) {
9324
+ if (this.interactionSystem?.isSourceBusy(world, input)) {
9318
9325
  if (this.teleportAim.cancel(source)) {
9319
9326
  this.aimCurve = [];
9320
9327
  this.landingPoint = null;
@@ -9323,8 +9330,9 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9323
9330
  continue;
9324
9331
  }
9325
9332
  const stick = this.readStickAim(input, source);
9326
- const aiming = input.select || stick.aiming;
9327
- const releasing = input.selectEnd || stick.released;
9333
+ const aiming = input.select || input.selectStart || stick.aiming;
9334
+ const vanished = !input.connected && this.teleportAim.isAiming(source);
9335
+ const releasing = input.selectEnd || stick.released || vanished;
9328
9336
  const commit = this.teleportAim.update(source, aiming, releasing);
9329
9337
  if (!aiming && !commit) continue;
9330
9338
  const points = sampleTeleportArc(
@@ -9344,6 +9352,12 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
9344
9352
  this.landingPoint = null;
9345
9353
  this.aimValid = false;
9346
9354
  } else if (commit) {
9355
+ if (!this.warnedNoLanding) {
9356
+ this.warnedNoLanding = true;
9357
+ console.warn(
9358
+ "[XRLocomotionSystem] Teleport released but the arc did not land on a Teleport Area. Add a teleportArea entity where the player should be able to go."
9359
+ );
9360
+ }
9347
9361
  this.aimCurve = [];
9348
9362
  this.aimValid = false;
9349
9363
  }