@relu-interactives/spatial-ecs 0.3.18 → 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.
Files changed (40) hide show
  1. package/dist/{XRHandPose-B8xxFb9A.d.cts → XRHandPose-CLl4MiHx.d.cts} +12 -2
  2. package/dist/{XRHandPose-ubMe5Igc.d.ts → XRHandPose-CrzI57JA.d.ts} +12 -2
  3. package/dist/{chunk-7SSOZWXM.js → chunk-CDSE7476.js} +82 -6
  4. package/dist/chunk-CDSE7476.js.map +1 -0
  5. package/dist/{chunk-PFE2SDXR.js → chunk-D6KXWNYT.js} +3 -3
  6. package/dist/{chunk-PFE2SDXR.js.map → chunk-D6KXWNYT.js.map} +1 -1
  7. package/dist/{chunk-J3EUNW57.js → chunk-H6DQ7JRE.js} +48 -18
  8. package/dist/chunk-H6DQ7JRE.js.map +1 -0
  9. package/dist/{chunk-KRWBNC6Y.js → chunk-P42OE3RU.js} +4 -4
  10. package/dist/{chunk-KRWBNC6Y.js.map → chunk-P42OE3RU.js.map} +1 -1
  11. package/dist/components/index.cjs +33 -10
  12. package/dist/components/index.cjs.map +1 -1
  13. package/dist/components/index.d.cts +3 -3
  14. package/dist/components/index.d.ts +3 -3
  15. package/dist/components/index.js +1 -1
  16. package/dist/docs/guide/vr-and-hand-poses.md +167 -0
  17. package/dist/factories/index.cjs +8 -0
  18. package/dist/factories/index.cjs.map +1 -1
  19. package/dist/factories/index.d.cts +2 -2
  20. package/dist/factories/index.d.ts +2 -2
  21. package/dist/factories/index.js +3 -3
  22. package/dist/{handPose-dFxqbFFY.d.cts → handPose-DlcTtqgx.d.cts} +26 -1
  23. package/dist/{handPose-dFxqbFFY.d.ts → handPose-DlcTtqgx.d.ts} +26 -1
  24. package/dist/{index-D7aSZ-e9.d.ts → index-6l4hn2Sh.d.ts} +15 -1
  25. package/dist/{index-7CFf45fo.d.cts → index-C2I5PxCI.d.cts} +15 -1
  26. package/dist/{index-DhWfxUgL.d.ts → index-JRcoel9F.d.ts} +3 -2
  27. package/dist/{index-CA9fqh4Z.d.cts → index-g777AmFv.d.cts} +3 -2
  28. package/dist/index.cjs +123 -16
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +11 -8
  31. package/dist/index.d.ts +11 -8
  32. package/dist/index.js +8 -8
  33. package/dist/systems/index.cjs +114 -16
  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/package.json +1 -1
  39. package/dist/chunk-7SSOZWXM.js.map +0 -1
  40. package/dist/chunk-J3EUNW57.js.map +0 -1
@@ -2008,22 +2008,27 @@ function fingers(thumb, index, middle, ring, pinky) {
2008
2008
  __name(fingers, "fingers");
2009
2009
  function handPoseFromCurls(id, name, curls, options) {
2010
2010
  const tolerance = options?.tolerance ?? NARROW;
2011
- const target = /* @__PURE__ */ __name((curl) => ({
2012
- curl: Math.min(1, Math.max(0, curl)),
2013
- tolerance
2014
- }), "target");
2011
+ const target = /* @__PURE__ */ __name((finger, curl) => {
2012
+ const directions = options?.directions?.[finger];
2013
+ return {
2014
+ curl: Math.min(1, Math.max(0, curl)),
2015
+ tolerance,
2016
+ ...directions && directions.length > 0 ? { directions } : {}
2017
+ };
2018
+ }, "target");
2015
2019
  return {
2016
2020
  id,
2017
2021
  name,
2018
2022
  fingers: {
2019
- thumb: target(curls.thumb),
2020
- index: target(curls.index),
2021
- middle: target(curls.middle),
2022
- ring: target(curls.ring),
2023
- pinky: target(curls.pinky)
2023
+ thumb: target("thumb", curls.thumb),
2024
+ index: target("index", curls.index),
2025
+ middle: target("middle", curls.middle),
2026
+ ring: target("ring", curls.ring),
2027
+ pinky: target("pinky", curls.pinky)
2024
2028
  },
2025
2029
  pinch: options?.pinch,
2026
2030
  orientation: options?.orientation,
2031
+ directionToleranceDegrees: options?.directionToleranceDegrees,
2027
2032
  hand: options?.hand
2028
2033
  };
2029
2034
  }
@@ -2037,6 +2042,13 @@ var DEFAULT_POSE_CURLS = {
2037
2042
  ring: 0,
2038
2043
  pinky: 0
2039
2044
  };
2045
+ var DEFAULT_POSE_DIRECTIONS = {
2046
+ thumb: [],
2047
+ index: [],
2048
+ middle: [],
2049
+ ring: [],
2050
+ pinky: []
2051
+ };
2040
2052
  function createHandPoseEntry(partial) {
2041
2053
  return {
2042
2054
  id: partial.id,
@@ -2044,6 +2056,14 @@ function createHandPoseEntry(partial) {
2044
2056
  preset: partial.preset ?? null,
2045
2057
  curls: { ...DEFAULT_POSE_CURLS, ...partial.curls },
2046
2058
  tolerance: partial.tolerance ?? 0.25,
2059
+ directions: {
2060
+ thumb: [...partial.directions?.thumb ?? []],
2061
+ index: [...partial.directions?.index ?? []],
2062
+ middle: [...partial.directions?.middle ?? []],
2063
+ ring: [...partial.directions?.ring ?? []],
2064
+ pinky: [...partial.directions?.pinky ?? []]
2065
+ },
2066
+ directionTolerance: partial.directionTolerance ?? 45,
2047
2067
  hand: partial.hand ?? null,
2048
2068
  orientation: partial.orientation ?? null,
2049
2069
  minHoldSeconds: partial.minHoldSeconds ?? 0.15,
@@ -2066,7 +2086,9 @@ function handPoseDefinitionFor(entry, resolvePreset) {
2066
2086
  return handPoseFromCurls(entry.id, entry.name, entry.curls, {
2067
2087
  tolerance: entry.tolerance,
2068
2088
  orientation: entry.orientation ?? void 0,
2069
- hand: entry.hand ?? void 0
2089
+ hand: entry.hand ?? void 0,
2090
+ directions: entry.directions,
2091
+ directionToleranceDegrees: entry.directionTolerance
2070
2092
  });
2071
2093
  }
2072
2094
  __name(handPoseDefinitionFor, "handPoseDefinitionFor");
@@ -2090,6 +2112,7 @@ exports.DEFAULT_INSTANCE_TRANSFORM = DEFAULT_INSTANCE_TRANSFORM;
2090
2112
  exports.DEFAULT_MESH_GEOMETRY_PARAMETERS = DEFAULT_MESH_GEOMETRY_PARAMETERS;
2091
2113
  exports.DEFAULT_PHYSICS_STATE = DEFAULT_PHYSICS_STATE;
2092
2114
  exports.DEFAULT_POSE_CURLS = DEFAULT_POSE_CURLS;
2115
+ exports.DEFAULT_POSE_DIRECTIONS = DEFAULT_POSE_DIRECTIONS;
2093
2116
  exports.DEFAULT_POSTPROCESSING_STATE = DEFAULT_POSTPROCESSING_STATE;
2094
2117
  exports.DEFAULT_RIGIDBODY_STATE = DEFAULT_RIGIDBODY_STATE;
2095
2118
  exports.EntityType = EntityType;