@relu-interactives/spatial-ecs 0.3.12 → 0.3.13
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-DawOR0uR.d.cts → XRHandPose-9mVZVU3K.d.cts} +24 -8
- package/dist/{XRHandPose-DhAd9Qi6.d.ts → XRHandPose-To0260Lc.d.ts} +24 -8
- package/dist/{chunk-OMDYLFTN.js → chunk-3LDQ4GVZ.js} +5 -5
- package/dist/chunk-3LDQ4GVZ.js.map +1 -0
- package/dist/{chunk-7ZIN6TGT.js → chunk-CHZQ4NXP.js} +3 -3
- package/dist/{chunk-7ZIN6TGT.js.map → chunk-CHZQ4NXP.js.map} +1 -1
- package/dist/{chunk-ID7U4FER.js → chunk-JHFBEMXM.js} +4 -4
- package/dist/{chunk-ID7U4FER.js.map → chunk-JHFBEMXM.js.map} +1 -1
- package/dist/{chunk-LCJ6IH2O.js → chunk-N2634D4W.js} +57 -14
- package/dist/chunk-N2634D4W.js.map +1 -0
- package/dist/components/index.cjs +3 -3
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/docs/guide/vr-and-hand-poses.md +5 -3
- package/dist/factories/index.cjs +3 -3
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +1 -1
- package/dist/factories/index.d.ts +1 -1
- package/dist/factories/index.js +3 -3
- package/dist/{index-Xm3im4Pt.d.cts → index-BPKDsVF7.d.cts} +1 -1
- package/dist/{index-M0I5B3JA.d.ts → index-BbXqWyEZ.d.ts} +20 -0
- package/dist/{index-B49322Q3.d.ts → index-Wzs-8FYa.d.ts} +1 -1
- package/dist/{index-DJ9bn9SF.d.cts → index-lqw8BM6E.d.cts} +20 -0
- package/dist/index.cjs +56 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -8
- package/dist/systems/index.cjs +56 -13
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +1 -1
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-LCJ6IH2O.js.map +0 -1
- package/dist/chunk-OMDYLFTN.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-CHZQ4NXP.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-3LDQ4GVZ.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';
|
|
@@ -3051,11 +3051,15 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
3051
3051
|
)
|
|
3052
3052
|
);
|
|
3053
3053
|
}
|
|
3054
|
-
if (typeof sourceInteractable.
|
|
3055
|
-
interactable.
|
|
3054
|
+
if (typeof sourceInteractable.applyVelocityOnRelease === "boolean") {
|
|
3055
|
+
interactable.applyVelocityOnRelease = sourceInteractable.applyVelocityOnRelease;
|
|
3056
|
+
} else if (typeof sourceInteractable.throwOnRelease === "boolean") {
|
|
3057
|
+
interactable.applyVelocityOnRelease = sourceInteractable.throwOnRelease;
|
|
3056
3058
|
}
|
|
3057
|
-
if (typeof sourceInteractable.
|
|
3058
|
-
interactable.
|
|
3059
|
+
if (typeof sourceInteractable.velocityScale === "number") {
|
|
3060
|
+
interactable.velocityScale = sourceInteractable.velocityScale;
|
|
3061
|
+
} else if (typeof sourceInteractable.throwStrength === "number") {
|
|
3062
|
+
interactable.velocityScale = sourceInteractable.throwStrength;
|
|
3059
3063
|
}
|
|
3060
3064
|
const grabPos = asRecord(sourceInteractable.grabOffsetPosition);
|
|
3061
3065
|
if (grabPos) {
|
|
@@ -3131,8 +3135,10 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
3131
3135
|
if (typeof sourceInteractor.handEmissiveIntensity === "number") {
|
|
3132
3136
|
interactor.handEmissiveIntensity = sourceInteractor.handEmissiveIntensity;
|
|
3133
3137
|
}
|
|
3134
|
-
if (typeof sourceInteractor.
|
|
3135
|
-
interactor.
|
|
3138
|
+
if (typeof sourceInteractor.rayVisibility === "string") {
|
|
3139
|
+
interactor.rayVisibility = sourceInteractor.rayVisibility;
|
|
3140
|
+
} else if (typeof sourceInteractor.showRay === "boolean") {
|
|
3141
|
+
interactor.rayVisibility = sourceInteractor.showRay ? "interacting" : "never";
|
|
3136
3142
|
}
|
|
3137
3143
|
if (typeof sourceInteractor.rayColor === "string") {
|
|
3138
3144
|
interactor.rayColor = sourceInteractor.rayColor;
|
|
@@ -7115,8 +7121,8 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
7115
7121
|
if (held.restoreBodyType !== null && physics) {
|
|
7116
7122
|
physics.values.rigidbody.type = held.restoreBodyType;
|
|
7117
7123
|
const dynamic = held.restoreBodyType === "dynamic";
|
|
7118
|
-
if (dynamic && interactable?.
|
|
7119
|
-
const velocity = held.tracker.computeVelocity(this.elapsed).multiplyScalar(interactable.
|
|
7124
|
+
if (dynamic && interactable?.applyVelocityOnRelease) {
|
|
7125
|
+
const velocity = held.tracker.computeVelocity(this.elapsed).multiplyScalar(interactable.velocityScale);
|
|
7120
7126
|
const spin = held.angularVelocity;
|
|
7121
7127
|
setPhysicsLiveRef(physics, "pendingVelocity", {
|
|
7122
7128
|
linear: { x: velocity.x, y: velocity.y, z: velocity.z },
|
|
@@ -7197,6 +7203,25 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
7197
7203
|
isGrabbing() {
|
|
7198
7204
|
return this.grabs.size > 0;
|
|
7199
7205
|
}
|
|
7206
|
+
/**
|
|
7207
|
+
* Whether this hand's primary action is committed to interaction.
|
|
7208
|
+
*
|
|
7209
|
+
* True while the hand holds something, and also while it merely HOVERS a
|
|
7210
|
+
* grabbable — because the pinch that is about to grab must not be read as a
|
|
7211
|
+
* teleport by the locomotion system. Without the hover half, the first pinch
|
|
7212
|
+
* of a grab teleports the player, and so does the pinch that takes an object
|
|
7213
|
+
* from the other hand.
|
|
7214
|
+
*/
|
|
7215
|
+
isHandBusy(world, handedness) {
|
|
7216
|
+
if (this.isGrabbingWith(handedness)) return true;
|
|
7217
|
+
const hover = this.getHoverFor(handedness);
|
|
7218
|
+
if (!hover) return false;
|
|
7219
|
+
const interactable = world.getComponent(
|
|
7220
|
+
hover.entityId,
|
|
7221
|
+
XRInteractableComponent
|
|
7222
|
+
);
|
|
7223
|
+
return Boolean(interactable?.enabled && interactable.grabbable);
|
|
7224
|
+
}
|
|
7200
7225
|
/** True when THIS hand is holding something. */
|
|
7201
7226
|
isGrabbingWith(handedness) {
|
|
7202
7227
|
for (const input of this.grabs.keys()) {
|
|
@@ -7287,8 +7312,20 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
|
|
|
7287
7312
|
this.stickAiming = /* @__PURE__ */ new WeakSet();
|
|
7288
7313
|
/** True once we've tried to self-heal camera parenting for this session. */
|
|
7289
7314
|
this.parentingChecked = false;
|
|
7315
|
+
/**
|
|
7316
|
+
* Optional; when wired, hands busy grabbing are excluded from teleport.
|
|
7317
|
+
*
|
|
7318
|
+
* On hand tracking the SAME pinch drives both grabbing and teleport aiming,
|
|
7319
|
+
* so without this a user who picks something up is teleported at the same
|
|
7320
|
+
* moment.
|
|
7321
|
+
*/
|
|
7322
|
+
this.interactionSystem = null;
|
|
7290
7323
|
this.inputSystem = inputSystem;
|
|
7291
7324
|
}
|
|
7325
|
+
/** Wire the interaction system so grabs suppress teleport on that hand. */
|
|
7326
|
+
setInteractionSystem(interactionSystem) {
|
|
7327
|
+
this.interactionSystem = interactionSystem;
|
|
7328
|
+
}
|
|
7292
7329
|
update(world, deltaTime) {
|
|
7293
7330
|
this.aimCurve = [];
|
|
7294
7331
|
this.landingPoint = null;
|
|
@@ -7406,6 +7443,9 @@ var _XRLocomotionSystem = class _XRLocomotionSystem {
|
|
|
7406
7443
|
applyTeleport(world, transform, inputs) {
|
|
7407
7444
|
const targets = this.collectTeleportTargets(world);
|
|
7408
7445
|
for (const input of inputs) {
|
|
7446
|
+
if (input.handedness !== "none" && this.interactionSystem?.isHandBusy(world, input.handedness)) {
|
|
7447
|
+
continue;
|
|
7448
|
+
}
|
|
7409
7449
|
const source = input;
|
|
7410
7450
|
const stick = this.readStickAim(input, source);
|
|
7411
7451
|
const aiming = input.select || stick.aiming;
|
|
@@ -7882,9 +7922,12 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
7882
7922
|
* clutter implying the whole scene is clickable.
|
|
7883
7923
|
*/
|
|
7884
7924
|
shouldShowRay(interactor, side) {
|
|
7885
|
-
|
|
7925
|
+
const visibility = interactor?.rayVisibility ?? "interacting";
|
|
7926
|
+
if (visibility === "never") return false;
|
|
7927
|
+
if (visibility === "always") return true;
|
|
7886
7928
|
if (!this.interactionSystem) return true;
|
|
7887
|
-
|
|
7929
|
+
if (this.interactionSystem.isGrabbingWith(side)) return false;
|
|
7930
|
+
return this.interactionSystem.getHoverFor(side) !== null;
|
|
7888
7931
|
}
|
|
7889
7932
|
/** Push the author's ray colour and thickness onto the mesh. */
|
|
7890
7933
|
applyRayStyle(ray, interactor) {
|
|
@@ -8773,5 +8816,5 @@ __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
|
|
|
8773
8816
|
var XRHoverVisualSystem = _XRHoverVisualSystem;
|
|
8774
8817
|
|
|
8775
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 };
|
|
8776
|
-
//# sourceMappingURL=chunk-
|
|
8777
|
-
//# sourceMappingURL=chunk-
|
|
8819
|
+
//# sourceMappingURL=chunk-N2634D4W.js.map
|
|
8820
|
+
//# sourceMappingURL=chunk-N2634D4W.js.map
|