@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.
@@ -7205,17 +7205,22 @@ var _XRInteractionSystem = class _XRInteractionSystem {
7205
7205
  return this.grabs.size > 0;
7206
7206
  }
7207
7207
  /**
7208
- * Whether this hand's primary action is committed to interaction.
7208
+ * Whether this input's primary action is committed to interaction.
7209
7209
  *
7210
- * True while the hand holds something, and also while it merely HOVERS a
7210
+ * True while the source holds something, and also while it merely HOVERS a
7211
7211
  * grabbable — because the pinch that is about to grab must not be read as a
7212
7212
  * teleport by the locomotion system. Without the hover half, the first pinch
7213
7213
  * of a grab teleports the player, and so does the pinch that takes an object
7214
7214
  * from the other hand.
7215
+ *
7216
+ * Keyed on the INPUT SOURCE rather than handedness. Vision Pro reports
7217
+ * `handedness: "none"` for every gaze-pinch (it is hard-coded in WebKit), so a
7218
+ * handedness-keyed check silently never matched there and each pinch both
7219
+ * grabbed and teleported.
7215
7220
  */
7216
- isHandBusy(world, handedness) {
7217
- if (this.isGrabbingWith(handedness)) return true;
7218
- const hover = this.getHoverFor(handedness);
7221
+ isSourceBusy(world, input) {
7222
+ if (this.grabs.has(input)) return true;
7223
+ const hover = this.hovers.get(input);
7219
7224
  if (!hover) return false;
7220
7225
  const interactable = world.getComponent(
7221
7226
  hover.entityId,
@@ -7309,7 +7314,7 @@ var _TeleportAimGate = class _TeleportAimGate {
7309
7314
  if (aiming) this.aiming.add(source);
7310
7315
  if (!releasing) return false;
7311
7316
  this.aiming.delete(source);
7312
- return hadAim;
7317
+ return hadAim || aiming;
7313
7318
  }
7314
7319
  /** True if this source currently has an aim engaged. */
7315
7320
  isAiming(source) {
@@ -7347,6 +7352,8 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7347
7352
  this.aimValid = false;
7348
7353
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
7349
7354
  this.stickAiming = /* @__PURE__ */ new WeakSet();
7355
+ /** One-time warning when a committed teleport found nowhere to land. */
7356
+ this.warnedNoLanding = false;
7350
7357
  /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
7351
7358
  this.teleportAim = new TeleportAimGate();
7352
7359
  /** True once we've tried to self-heal camera parenting for this session. */
@@ -7483,7 +7490,7 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7483
7490
  const targets = this.collectTeleportTargets(world);
7484
7491
  for (const input of inputs) {
7485
7492
  const source = input;
7486
- if (input.handedness !== "none" && this.interactionSystem?.isHandBusy(world, input.handedness)) {
7493
+ if (this.interactionSystem?.isSourceBusy(world, input)) {
7487
7494
  if (this.teleportAim.cancel(source)) {
7488
7495
  this.aimCurve = [];
7489
7496
  this.landingPoint = null;
@@ -7492,8 +7499,9 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7492
7499
  continue;
7493
7500
  }
7494
7501
  const stick = this.readStickAim(input, source);
7495
- const aiming = input.select || stick.aiming;
7496
- const releasing = input.selectEnd || stick.released;
7502
+ const aiming = input.select || input.selectStart || stick.aiming;
7503
+ const vanished = !input.connected && this.teleportAim.isAiming(source);
7504
+ const releasing = input.selectEnd || stick.released || vanished;
7497
7505
  const commit = this.teleportAim.update(source, aiming, releasing);
7498
7506
  if (!aiming && !commit) continue;
7499
7507
  const points = sampleTeleportArc(
@@ -7513,6 +7521,12 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7513
7521
  this.landingPoint = null;
7514
7522
  this.aimValid = false;
7515
7523
  } else if (commit) {
7524
+ if (!this.warnedNoLanding) {
7525
+ this.warnedNoLanding = true;
7526
+ console.warn(
7527
+ "[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."
7528
+ );
7529
+ }
7516
7530
  this.aimCurve = [];
7517
7531
  this.aimValid = false;
7518
7532
  }
@@ -8861,5 +8875,5 @@ __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
8861
8875
  var XRHoverVisualSystem = _XRHoverVisualSystem;
8862
8876
 
8863
8877
  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 };
8864
- //# sourceMappingURL=chunk-XHMOFI3Q.js.map
8865
- //# sourceMappingURL=chunk-XHMOFI3Q.js.map
8878
+ //# sourceMappingURL=chunk-CE2CPZSP.js.map
8879
+ //# sourceMappingURL=chunk-CE2CPZSP.js.map