@relu-interactives/spatial-ecs 0.3.6 → 0.3.8
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/{System-TmC2EijF.d.cts → System-31wk-A0g.d.cts} +1 -1
- package/dist/{System-TmC2EijF.d.ts → System-31wk-A0g.d.ts} +1 -1
- package/dist/{XRInteractor-CCUzSqg9.d.ts → XRHandPose-CxPz8VBp.d.ts} +139 -20
- package/dist/{XRInteractor-I2q6TKtF.d.cts → XRHandPose-VuSbe4iz.d.cts} +139 -20
- package/dist/{chunk-FQTOC7HK.js → chunk-KIKIWCEB.js} +14 -5
- package/dist/chunk-KIKIWCEB.js.map +1 -0
- package/dist/{chunk-N4GKZ7IV.js → chunk-KVGGAL5V.js} +227 -3
- package/dist/chunk-KVGGAL5V.js.map +1 -0
- package/dist/{chunk-JRJ3CL5H.js → chunk-L5BP727H.js} +3 -3
- package/dist/{chunk-JRJ3CL5H.js.map → chunk-L5BP727H.js.map} +1 -1
- package/dist/{chunk-WRJ2K3LZ.js → chunk-LMTB4KQ4.js} +1011 -56
- package/dist/chunk-LMTB4KQ4.js.map +1 -0
- package/dist/components/index.cjs +98 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +4 -3
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/vr-and-hand-poses.md +111 -0
- package/dist/factories/index.cjs +58 -0
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +6 -3
- package/dist/factories/index.d.ts +6 -3
- package/dist/factories/index.js +3 -3
- package/dist/handPose-dFxqbFFY.d.cts +240 -0
- package/dist/handPose-dFxqbFFY.d.ts +240 -0
- package/dist/{index-W8pUajCW.d.ts → index-BIQoaKAA.d.cts} +9 -3
- package/dist/{index-BltjPEhg.d.cts → index-BxdXgqiI.d.ts} +9 -3
- package/dist/{index-BpbmZuOz.d.ts → index-C7XQyrgE.d.ts} +101 -7
- package/dist/{index-C5FrDt3z.d.cts → index-DyN50JZo.d.cts} +101 -7
- package/dist/index.cjs +1269 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -9
- package/dist/index.d.ts +104 -9
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +1226 -51
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +3 -2
- package/dist/systems/index.d.ts +3 -2
- package/dist/systems/index.js +3 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/worldSnapshotUtils.d.cts +1 -1
- package/dist/worldSnapshotUtils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-FQTOC7HK.js.map +0 -1
- package/dist/chunk-N4GKZ7IV.js.map +0 -1
- package/dist/chunk-WRJ2K3LZ.js.map +0 -1
|
@@ -1917,6 +1917,22 @@ var _XRInteractableComponent = class _XRInteractableComponent extends Component
|
|
|
1917
1917
|
this.grabbable = options?.grabbable ?? true;
|
|
1918
1918
|
this.pointable = options?.pointable ?? true;
|
|
1919
1919
|
this.grabMode = options?.grabMode ?? "kinematic";
|
|
1920
|
+
this.grabReach = options?.grabReach ?? "both";
|
|
1921
|
+
this.distanceBehavior = options?.distanceBehavior ?? "snap";
|
|
1922
|
+
this.grabGesture = options?.grabGesture ?? "any";
|
|
1923
|
+
this.grabRadius = options?.grabRadius ?? 0.15;
|
|
1924
|
+
this.grabOffsetPosition = options?.grabOffsetPosition ?? {
|
|
1925
|
+
x: 0,
|
|
1926
|
+
y: 0,
|
|
1927
|
+
z: 0
|
|
1928
|
+
};
|
|
1929
|
+
this.grabOffsetRotation = options?.grabOffsetRotation ?? {
|
|
1930
|
+
x: 0,
|
|
1931
|
+
y: 0,
|
|
1932
|
+
z: 0
|
|
1933
|
+
};
|
|
1934
|
+
this.throwOnRelease = options?.throwOnRelease ?? true;
|
|
1935
|
+
this.throwStrength = options?.throwStrength ?? 1;
|
|
1920
1936
|
this.highlightOnHover = options?.highlightOnHover ?? true;
|
|
1921
1937
|
}
|
|
1922
1938
|
};
|
|
@@ -1960,6 +1976,84 @@ var _XRInteractorSideComponent = class _XRInteractorSideComponent extends Compon
|
|
|
1960
1976
|
};
|
|
1961
1977
|
__name(_XRInteractorSideComponent, "XRInteractorSideComponent");
|
|
1962
1978
|
var XRInteractorSideComponent = _XRInteractorSideComponent;
|
|
1979
|
+
var NARROW = 0.25;
|
|
1980
|
+
function fingers(thumb, index, middle, ring, pinky) {
|
|
1981
|
+
return { thumb, index, middle, ring, pinky };
|
|
1982
|
+
}
|
|
1983
|
+
__name(fingers, "fingers");
|
|
1984
|
+
function handPoseFromCurls(id, name, curls, options) {
|
|
1985
|
+
const tolerance = options?.tolerance ?? NARROW;
|
|
1986
|
+
const target = /* @__PURE__ */ __name((curl) => ({
|
|
1987
|
+
curl: Math.min(1, Math.max(0, curl)),
|
|
1988
|
+
tolerance
|
|
1989
|
+
}), "target");
|
|
1990
|
+
return {
|
|
1991
|
+
id,
|
|
1992
|
+
name,
|
|
1993
|
+
fingers: {
|
|
1994
|
+
thumb: target(curls.thumb),
|
|
1995
|
+
index: target(curls.index),
|
|
1996
|
+
middle: target(curls.middle),
|
|
1997
|
+
ring: target(curls.ring),
|
|
1998
|
+
pinky: target(curls.pinky)
|
|
1999
|
+
},
|
|
2000
|
+
pinch: options?.pinch,
|
|
2001
|
+
orientation: options?.orientation,
|
|
2002
|
+
hand: options?.hand
|
|
2003
|
+
};
|
|
2004
|
+
}
|
|
2005
|
+
__name(handPoseFromCurls, "handPoseFromCurls");
|
|
2006
|
+
|
|
2007
|
+
// core/components/XRHandPose.ts
|
|
2008
|
+
var DEFAULT_POSE_CURLS = {
|
|
2009
|
+
thumb: 0,
|
|
2010
|
+
index: 0,
|
|
2011
|
+
middle: 0,
|
|
2012
|
+
ring: 0,
|
|
2013
|
+
pinky: 0
|
|
2014
|
+
};
|
|
2015
|
+
function createHandPoseEntry(partial) {
|
|
2016
|
+
return {
|
|
2017
|
+
id: partial.id,
|
|
2018
|
+
name: partial.name ?? partial.id,
|
|
2019
|
+
preset: partial.preset ?? null,
|
|
2020
|
+
curls: { ...DEFAULT_POSE_CURLS, ...partial.curls },
|
|
2021
|
+
tolerance: partial.tolerance ?? 0.25,
|
|
2022
|
+
hand: partial.hand ?? null,
|
|
2023
|
+
orientation: partial.orientation ?? null,
|
|
2024
|
+
minHoldSeconds: partial.minHoldSeconds ?? 0.15,
|
|
2025
|
+
enabled: partial.enabled ?? true
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
__name(createHandPoseEntry, "createHandPoseEntry");
|
|
2029
|
+
function handPoseDefinitionFor(entry, resolvePreset) {
|
|
2030
|
+
if (entry.preset) {
|
|
2031
|
+
const preset = resolvePreset(entry.preset);
|
|
2032
|
+
if (!preset) return null;
|
|
2033
|
+
return {
|
|
2034
|
+
...preset,
|
|
2035
|
+
id: entry.id,
|
|
2036
|
+
name: entry.name,
|
|
2037
|
+
hand: entry.hand ?? preset.hand,
|
|
2038
|
+
orientation: entry.orientation ?? preset.orientation
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
return handPoseFromCurls(entry.id, entry.name, entry.curls, {
|
|
2042
|
+
tolerance: entry.tolerance,
|
|
2043
|
+
orientation: entry.orientation ?? void 0,
|
|
2044
|
+
hand: entry.hand ?? void 0
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
__name(handPoseDefinitionFor, "handPoseDefinitionFor");
|
|
2048
|
+
var _XRHandPoseComponent = class _XRHandPoseComponent extends Component {
|
|
2049
|
+
constructor(options) {
|
|
2050
|
+
super();
|
|
2051
|
+
this.enabled = options?.enabled ?? true;
|
|
2052
|
+
this.poses = (options?.poses ?? []).map((pose) => createHandPoseEntry(pose));
|
|
2053
|
+
}
|
|
2054
|
+
};
|
|
2055
|
+
__name(_XRHandPoseComponent, "XRHandPoseComponent");
|
|
2056
|
+
var XRHandPoseComponent = _XRHandPoseComponent;
|
|
1963
2057
|
|
|
1964
2058
|
exports.AnimationComponent = AnimationComponent;
|
|
1965
2059
|
exports.AudioComponent = AudioComponent;
|
|
@@ -1970,6 +2064,7 @@ exports.DEFAULT_INSTANCED_MESH_PARAMETERS = DEFAULT_INSTANCED_MESH_PARAMETERS;
|
|
|
1970
2064
|
exports.DEFAULT_INSTANCE_TRANSFORM = DEFAULT_INSTANCE_TRANSFORM;
|
|
1971
2065
|
exports.DEFAULT_MESH_GEOMETRY_PARAMETERS = DEFAULT_MESH_GEOMETRY_PARAMETERS;
|
|
1972
2066
|
exports.DEFAULT_PHYSICS_STATE = DEFAULT_PHYSICS_STATE;
|
|
2067
|
+
exports.DEFAULT_POSE_CURLS = DEFAULT_POSE_CURLS;
|
|
1973
2068
|
exports.DEFAULT_POSTPROCESSING_STATE = DEFAULT_POSTPROCESSING_STATE;
|
|
1974
2069
|
exports.DEFAULT_RIGIDBODY_STATE = DEFAULT_RIGIDBODY_STATE;
|
|
1975
2070
|
exports.EntityType = EntityType;
|
|
@@ -1999,11 +2094,14 @@ exports.SpriteComponent = SpriteComponent;
|
|
|
1999
2094
|
exports.TransformComponent = TransformComponent;
|
|
2000
2095
|
exports.VRTeleportAreaComponent = VRTeleportAreaComponent;
|
|
2001
2096
|
exports.VideoComponent = VideoComponent;
|
|
2097
|
+
exports.XRHandPoseComponent = XRHandPoseComponent;
|
|
2002
2098
|
exports.XRInteractableComponent = XRInteractableComponent;
|
|
2003
2099
|
exports.XRInteractorComponent = XRInteractorComponent;
|
|
2004
2100
|
exports.XRInteractorSideComponent = XRInteractorSideComponent;
|
|
2005
2101
|
exports.XRRigComponent = XRRigComponent;
|
|
2102
|
+
exports.createHandPoseEntry = createHandPoseEntry;
|
|
2006
2103
|
exports.defaultMaterialValue = defaultMaterialValue;
|
|
2104
|
+
exports.handPoseDefinitionFor = handPoseDefinitionFor;
|
|
2007
2105
|
exports.normalizePhysicsState = normalizePhysicsState;
|
|
2008
2106
|
exports.setPhysicsLiveRef = setPhysicsLiveRef;
|
|
2009
2107
|
//# sourceMappingURL=index.cjs.map
|