@relu-interactives/spatial-ecs 0.3.19 → 0.3.20

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.
@@ -6463,6 +6463,25 @@ var _XRInputSystem = class _XRInputSystem {
6463
6463
  }
6464
6464
  return null;
6465
6465
  }
6466
+ /**
6467
+ * The ARTICULATED source for a hand — the one carrying joint poses.
6468
+ *
6469
+ * Distinct from {@link getInput} because a hand can be backed by several
6470
+ * sources at once: a Quest reports a controller AND a tracked hand for the
6471
+ * same handedness, and Vision Pro adds a transient pinch alongside its two
6472
+ * persistent hands. `getInput` returns whichever was seen first, so anything
6473
+ * needing JOINTS has to ask for them specifically — taking the first match
6474
+ * silently handed pose detection a controller with no joints, and no pose
6475
+ * ever fired.
6476
+ */
6477
+ getHandInput(handedness) {
6478
+ for (const record of this.records.values()) {
6479
+ const state = record.state;
6480
+ if (state.handedness !== handedness) continue;
6481
+ if (state.joints) return state;
6482
+ }
6483
+ return null;
6484
+ }
6466
6485
  /** True while ANY source is selecting — the portable "is the user acting" check. */
6467
6486
  isSelecting() {
6468
6487
  for (const record of this.records.values()) {
@@ -8727,6 +8746,8 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
8727
8746
  /** Reused so head-relative orientation checks allocate nothing per frame. */
8728
8747
  this.headPosition = new THREE19.Vector3();
8729
8748
  this.elapsed = 0;
8749
+ this.warnedNoHands = false;
8750
+ this.noHandSeconds = 0;
8730
8751
  this.inputSystem = inputSystem;
8731
8752
  }
8732
8753
  update(world, deltaTime) {
@@ -8738,6 +8759,20 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
8738
8759
  this.refreshShapes();
8739
8760
  const entries = this.collectEntries(world);
8740
8761
  if (entries.length === 0) return;
8762
+ if (!this.warnedNoHands) {
8763
+ const tracked = this.shapes.get("left") !== null || this.shapes.get("right") !== null;
8764
+ if (tracked) {
8765
+ this.warnedNoHands = true;
8766
+ } else {
8767
+ this.noHandSeconds += deltaTime;
8768
+ if (this.noHandSeconds > 5) {
8769
+ this.warnedNoHands = true;
8770
+ console.warn(
8771
+ "[XRHandPoseSystem] Hand poses are configured but no tracked hands have been seen. Hand poses need HAND TRACKING \u2014 put the controllers down and enable hand tracking on the headset."
8772
+ );
8773
+ }
8774
+ }
8775
+ }
8741
8776
  world.getCamera().getWorldPosition(this.headPosition);
8742
8777
  const context = { headPosition: this.headPosition };
8743
8778
  for (const { entityId, entry } of entries) {
@@ -8782,7 +8817,7 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
8782
8817
  /** Derive each hand's shape once for the whole frame. */
8783
8818
  refreshShapes() {
8784
8819
  for (const handedness of ["left", "right"]) {
8785
- const input = this.inputSystem.getInput(handedness);
8820
+ const input = this.inputSystem.getHandInput(handedness);
8786
8821
  const joints = input?.joints ?? null;
8787
8822
  this.shapes.set(
8788
8823
  handedness,
@@ -8994,5 +9029,5 @@ __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
8994
9029
  var XRHoverVisualSystem = _XRHoverVisualSystem;
8995
9030
 
8996
9031
  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 };
8997
- //# sourceMappingURL=chunk-JYKFLQB5.js.map
8998
- //# sourceMappingURL=chunk-JYKFLQB5.js.map
9032
+ //# sourceMappingURL=chunk-CDSE7476.js.map
9033
+ //# sourceMappingURL=chunk-CDSE7476.js.map