@relu-interactives/spatial-ecs 0.3.13 → 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 (39) 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-9mVZVU3K.d.cts → XRHandPose-LR4EhboN.d.cts} +1 -1
  4. package/dist/{XRHandPose-To0260Lc.d.ts → XRHandPose-SZ7ou63b.d.ts} +1 -1
  5. package/dist/{chunk-CHZQ4NXP.js → chunk-PNQ7HDQC.js} +2 -2
  6. package/dist/{chunk-CHZQ4NXP.js.map → chunk-PNQ7HDQC.js.map} +1 -1
  7. package/dist/{chunk-JHFBEMXM.js → chunk-UHJ4MDIM.js} +6 -3
  8. package/dist/chunk-UHJ4MDIM.js.map +1 -0
  9. package/dist/{chunk-N2634D4W.js → chunk-XHMOFI3Q.js} +51 -6
  10. package/dist/chunk-XHMOFI3Q.js.map +1 -0
  11. package/dist/components/index.d.cts +3 -3
  12. package/dist/components/index.d.ts +3 -3
  13. package/dist/docs/guide/vr-and-hand-poses.md +1 -1
  14. package/dist/factories/index.cjs +3 -0
  15. package/dist/factories/index.cjs.map +1 -1
  16. package/dist/factories/index.d.cts +2 -2
  17. package/dist/factories/index.d.ts +2 -2
  18. package/dist/factories/index.js +2 -2
  19. package/dist/{index-BPKDsVF7.d.cts → index-BL5EWkwY.d.cts} +2 -2
  20. package/dist/{index-Wzs-8FYa.d.ts → index-ByiUoIoh.d.ts} +2 -2
  21. package/dist/{index-lqw8BM6E.d.cts → index-CbrjAm_8.d.cts} +3 -1
  22. package/dist/{index-BbXqWyEZ.d.ts → index-CvIXdHzx.d.ts} +3 -1
  23. package/dist/index.cjs +51 -2
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +45 -8
  26. package/dist/index.d.ts +45 -8
  27. package/dist/index.js +6 -6
  28. package/dist/systems/index.cjs +47 -2
  29. package/dist/systems/index.cjs.map +1 -1
  30. package/dist/systems/index.d.cts +2 -2
  31. package/dist/systems/index.d.ts +2 -2
  32. package/dist/systems/index.js +2 -2
  33. package/dist/types.d.cts +1 -1
  34. package/dist/types.d.ts +1 -1
  35. package/dist/worldSnapshotUtils.d.cts +1 -1
  36. package/dist/worldSnapshotUtils.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-JHFBEMXM.js.map +0 -1
  39. package/dist/chunk-N2634D4W.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { resolveDracoDecoderPath, applyTransform, SHARED_MODEL_RESOURCE_FLAG } from './chunk-CHZQ4NXP.js';
1
+ import { resolveDracoDecoderPath, applyTransform, SHARED_MODEL_RESOURCE_FLAG } from './chunk-PNQ7HDQC.js';
2
2
  import { AnimationComponent, ModelComponent, CameraComponent, Object3DRef, Environment, Postprocessing, TransformComponent, PhysicsComponent, setPhysicsLiveRef, LightComponent, MaterialComponent, DEFAULT_MESH_GEOMETRY_PARAMETERS, MeshGeometryComponent, InstancedMeshComponent, ParentId, ScriptComponent, ScriptObjectComponent, XRRigComponent, VRTeleportAreaComponent, XRInteractableComponent, createAttachPoint, XRHandPoseComponent, createHandPoseEntry, XRInteractorComponent, XRInteractorSideComponent, InstanceSlotComponent, Name, ImageComponent, SpriteComponent, VideoComponent, AudioComponent, ImageTarget, Selectable, PrefabNode, PrefabInstance, handPoseDefinitionFor, getHandPosePreset } from './chunk-3LDQ4GVZ.js';
3
3
  import { __name } from './chunk-OY7ZODZP.js';
4
4
  import * as THREE19 from 'three';
@@ -3945,6 +3945,7 @@ function hydrateWorldFromSnapshotDetailed(snapshot, world, objectManagementSyste
3945
3945
  isDefault: true
3946
3946
  };
3947
3947
  }
3948
+ payload.skipDefaultChildren = true;
3948
3949
  const createdEntityId = objectManagementSystem.createNow(kind, world, payload);
3949
3950
  idMap.set(sourceEntityId, createdEntityId);
3950
3951
  }
@@ -7293,6 +7294,42 @@ function arcGroundCrossing(points, groundY) {
7293
7294
  }
7294
7295
  __name(arcGroundCrossing, "arcGroundCrossing");
7295
7296
 
7297
+ // core/xr/teleportAimGate.ts
7298
+ var _TeleportAimGate = class _TeleportAimGate {
7299
+ constructor() {
7300
+ this.aiming = /* @__PURE__ */ new WeakSet();
7301
+ }
7302
+ /**
7303
+ * Feed one frame for one source.
7304
+ *
7305
+ * @returns whether the teleport should commit this frame.
7306
+ */
7307
+ update(source, aiming, releasing) {
7308
+ const hadAim = this.aiming.has(source);
7309
+ if (aiming) this.aiming.add(source);
7310
+ if (!releasing) return false;
7311
+ this.aiming.delete(source);
7312
+ return hadAim;
7313
+ }
7314
+ /** True if this source currently has an aim engaged. */
7315
+ isAiming(source) {
7316
+ return this.aiming.has(source);
7317
+ }
7318
+ /**
7319
+ * Drop a source's aim without committing.
7320
+ *
7321
+ * Called when a hand starts interacting, so the release that ends the grab
7322
+ * cannot cash in an aim engaged before it.
7323
+ *
7324
+ * @returns whether an aim was actually discarded.
7325
+ */
7326
+ cancel(source) {
7327
+ return this.aiming.delete(source);
7328
+ }
7329
+ };
7330
+ __name(_TeleportAimGate, "TeleportAimGate");
7331
+ var TeleportAimGate = _TeleportAimGate;
7332
+
7296
7333
  // core/systems/XRLocomotionSystem.ts
7297
7334
  var UP = new THREE19.Vector3(0, 1, 0);
7298
7335
  var AXIS_DEADZONE = 0.5;
@@ -7310,6 +7347,8 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7310
7347
  this.aimValid = false;
7311
7348
  /** Sources currently aiming via thumbstick (hysteresis, so it doesn't chatter). */
7312
7349
  this.stickAiming = /* @__PURE__ */ new WeakSet();
7350
+ /** Gates teleport commits on a prior aim. See {@link TeleportAimGate}. */
7351
+ this.teleportAim = new TeleportAimGate();
7313
7352
  /** True once we've tried to self-heal camera parenting for this session. */
7314
7353
  this.parentingChecked = false;
7315
7354
  /**
@@ -7443,13 +7482,19 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
7443
7482
  applyTeleport(world, transform, inputs) {
7444
7483
  const targets = this.collectTeleportTargets(world);
7445
7484
  for (const input of inputs) {
7485
+ const source = input;
7446
7486
  if (input.handedness !== "none" && this.interactionSystem?.isHandBusy(world, input.handedness)) {
7487
+ if (this.teleportAim.cancel(source)) {
7488
+ this.aimCurve = [];
7489
+ this.landingPoint = null;
7490
+ this.aimValid = false;
7491
+ }
7447
7492
  continue;
7448
7493
  }
7449
- const source = input;
7450
7494
  const stick = this.readStickAim(input, source);
7451
7495
  const aiming = input.select || stick.aiming;
7452
- const commit = input.selectEnd || stick.released;
7496
+ const releasing = input.selectEnd || stick.released;
7497
+ const commit = this.teleportAim.update(source, aiming, releasing);
7453
7498
  if (!aiming && !commit) continue;
7454
7499
  const points = sampleTeleportArc(
7455
7500
  input.rayOrigin,
@@ -8815,6 +8860,6 @@ var _XRHoverVisualSystem = class _XRHoverVisualSystem {
8815
8860
  __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
8816
8861
  var XRHoverVisualSystem = _XRHoverVisualSystem;
8817
8862
 
8818
- 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 };
8819
- //# sourceMappingURL=chunk-N2634D4W.js.map
8820
- //# sourceMappingURL=chunk-N2634D4W.js.map
8863
+ 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