@relu-interactives/spatial-ecs 0.3.18 → 0.3.19
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/{XRHandPose-B8xxFb9A.d.cts → XRHandPose-CLl4MiHx.d.cts} +12 -2
- package/dist/{XRHandPose-ubMe5Igc.d.ts → XRHandPose-CrzI57JA.d.ts} +12 -2
- package/dist/{chunk-PFE2SDXR.js → chunk-D6KXWNYT.js} +3 -3
- package/dist/{chunk-PFE2SDXR.js.map → chunk-D6KXWNYT.js.map} +1 -1
- package/dist/{chunk-J3EUNW57.js → chunk-H6DQ7JRE.js} +48 -18
- package/dist/chunk-H6DQ7JRE.js.map +1 -0
- package/dist/{chunk-7SSOZWXM.js → chunk-JYKFLQB5.js} +46 -5
- package/dist/chunk-JYKFLQB5.js.map +1 -0
- package/dist/{chunk-KRWBNC6Y.js → chunk-P42OE3RU.js} +4 -4
- package/dist/{chunk-KRWBNC6Y.js.map → chunk-P42OE3RU.js.map} +1 -1
- package/dist/components/index.cjs +33 -10
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/vr-and-hand-poses.md +67 -0
- package/dist/factories/index.cjs +8 -0
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +2 -2
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +3 -3
- package/dist/{handPose-dFxqbFFY.d.cts → handPose-DlcTtqgx.d.cts} +26 -1
- package/dist/{handPose-dFxqbFFY.d.ts → handPose-DlcTtqgx.d.ts} +26 -1
- package/dist/{index-7CFf45fo.d.cts → index-3pNbH0iP.d.cts} +1 -1
- package/dist/{index-D7aSZ-e9.d.ts → index-C_589fc4.d.ts} +1 -1
- package/dist/{index-DhWfxUgL.d.ts → index-JRcoel9F.d.ts} +3 -2
- package/dist/{index-CA9fqh4Z.d.cts → index-g777AmFv.d.cts} +3 -2
- package/dist/index.cjs +87 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +78 -15
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +2 -2
- package/dist/systems/index.d.ts +2 -2
- package/dist/systems/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7SSOZWXM.js.map +0 -1
- package/dist/chunk-J3EUNW57.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveDracoDecoderPath, applyTransform, SHARED_MODEL_RESOURCE_FLAG } from './chunk-
|
|
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-
|
|
1
|
+
import { resolveDracoDecoderPath, applyTransform, SHARED_MODEL_RESOURCE_FLAG } from './chunk-D6KXWNYT.js';
|
|
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-H6DQ7JRE.js';
|
|
3
3
|
import { __name } from './chunk-OY7ZODZP.js';
|
|
4
4
|
import * as THREE19 from 'three';
|
|
5
5
|
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
@@ -8506,10 +8506,22 @@ function computeHandShape(joints, handedness) {
|
|
|
8506
8506
|
const direction = new THREE19.Vector3().subVectors(thumbTip, thumbBase);
|
|
8507
8507
|
if (direction.lengthSq() > 1e-12) thumbDirection = direction.normalize();
|
|
8508
8508
|
}
|
|
8509
|
+
const fingerDirections = {};
|
|
8510
|
+
for (const finger of XR_FINGERS) {
|
|
8511
|
+
const base = joints[METACARPAL_JOINTS[finger]];
|
|
8512
|
+
const tip = joints[TIP_JOINTS[finger]];
|
|
8513
|
+
if (!base || !tip) {
|
|
8514
|
+
fingerDirections[finger] = null;
|
|
8515
|
+
continue;
|
|
8516
|
+
}
|
|
8517
|
+
const direction = new THREE19.Vector3().subVectors(tip, base);
|
|
8518
|
+
fingerDirections[finger] = direction.lengthSq() > 1e-12 ? direction.normalize() : null;
|
|
8519
|
+
}
|
|
8509
8520
|
return {
|
|
8510
8521
|
handedness,
|
|
8511
8522
|
fingers,
|
|
8512
8523
|
pinch,
|
|
8524
|
+
fingerDirections,
|
|
8513
8525
|
spread: {
|
|
8514
8526
|
thumbIndex: computeSpread(joints, "thumb", "index") ?? 0,
|
|
8515
8527
|
indexMiddle: computeSpread(joints, "index", "middle") ?? 0,
|
|
@@ -8534,6 +8546,7 @@ function scoreAgainst(actual, target, tolerance) {
|
|
|
8534
8546
|
return clamp01(1 - (error - tolerance) / MATCH_FALLOFF);
|
|
8535
8547
|
}
|
|
8536
8548
|
__name(scoreAgainst, "scoreAgainst");
|
|
8549
|
+
var DEFAULT_DIRECTION_TOLERANCE = 45;
|
|
8537
8550
|
var WORLD_DIRECTIONS = {
|
|
8538
8551
|
up: new THREE19.Vector3(0, 1, 0),
|
|
8539
8552
|
down: new THREE19.Vector3(0, -1, 0),
|
|
@@ -8561,6 +8574,22 @@ function resolveDirection(direction, shape, context) {
|
|
|
8561
8574
|
return direction === "toward-head" ? toHead : toHead.multiplyScalar(-1);
|
|
8562
8575
|
}
|
|
8563
8576
|
__name(resolveDirection, "resolveDirection");
|
|
8577
|
+
function scoreDirections(actual, accepted, shape, toleranceDegrees, context) {
|
|
8578
|
+
if (!actual) return 0;
|
|
8579
|
+
let best = 0;
|
|
8580
|
+
for (const direction of accepted) {
|
|
8581
|
+
const wanted = resolveDirection(direction, shape, context);
|
|
8582
|
+
if (!wanted) continue;
|
|
8583
|
+
const angle = THREE19.MathUtils.radToDeg(
|
|
8584
|
+
Math.acos(THREE19.MathUtils.clamp(actual.dot(wanted), -1, 1))
|
|
8585
|
+
);
|
|
8586
|
+
const normalizedError = Math.max(0, angle - toleranceDegrees) / 90;
|
|
8587
|
+
const score = clamp01(1 - normalizedError / MATCH_FALLOFF);
|
|
8588
|
+
if (score > best) best = score;
|
|
8589
|
+
}
|
|
8590
|
+
return best;
|
|
8591
|
+
}
|
|
8592
|
+
__name(scoreDirections, "scoreDirections");
|
|
8564
8593
|
function matchHandPose(shape, definition, context) {
|
|
8565
8594
|
if (definition.hand && definition.hand !== shape.handedness) return NO_MATCH;
|
|
8566
8595
|
let confidence = 1;
|
|
@@ -8590,6 +8619,18 @@ function matchHandPose(shape, definition, context) {
|
|
|
8590
8619
|
`${finger} tip`
|
|
8591
8620
|
);
|
|
8592
8621
|
}
|
|
8622
|
+
if (target.directions && target.directions.length > 0) {
|
|
8623
|
+
consider(
|
|
8624
|
+
scoreDirections(
|
|
8625
|
+
shape.fingerDirections[finger],
|
|
8626
|
+
target.directions,
|
|
8627
|
+
shape,
|
|
8628
|
+
definition.directionToleranceDegrees ?? DEFAULT_DIRECTION_TOLERANCE,
|
|
8629
|
+
context
|
|
8630
|
+
),
|
|
8631
|
+
`${finger} direction`
|
|
8632
|
+
);
|
|
8633
|
+
}
|
|
8593
8634
|
}
|
|
8594
8635
|
if (definition.pinch) {
|
|
8595
8636
|
const { finger, target, tolerance } = definition.pinch;
|
|
@@ -8952,6 +8993,6 @@ var _XRHoverVisualSystem = class _XRHoverVisualSystem {
|
|
|
8952
8993
|
__name(_XRHoverVisualSystem, "XRHoverVisualSystem");
|
|
8953
8994
|
var XRHoverVisualSystem = _XRHoverVisualSystem;
|
|
8954
8995
|
|
|
8955
|
-
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 };
|
|
8956
|
-
//# sourceMappingURL=chunk-
|
|
8957
|
-
//# sourceMappingURL=chunk-
|
|
8996
|
+
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
|