@relu-interactives/spatial-ecs 0.3.8 → 0.3.9
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/{chunk-LMTB4KQ4.js → chunk-W5TSYV6Q.js} +21 -12
- package/dist/chunk-W5TSYV6Q.js.map +1 -0
- package/dist/index.cjs +19 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +2 -2
- package/dist/systems/index.cjs +18 -9
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LMTB4KQ4.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -872,6 +872,20 @@ declare const VELOCITY_SAMPLES = 5;
|
|
|
872
872
|
* from before the pause.
|
|
873
873
|
*/
|
|
874
874
|
declare const MAX_SAMPLE_AGE_SECONDS = 0.2;
|
|
875
|
+
/**
|
|
876
|
+
* Fastest hand motion treated as real, in metres/second.
|
|
877
|
+
*
|
|
878
|
+
* Samples are recorded in WORLD space, so anything that moves the XR rig while
|
|
879
|
+
* an object is held — teleport, snap turn — relocates the hand instantly and
|
|
880
|
+
* implies an enormous velocity. Releasing after a teleport would otherwise
|
|
881
|
+
* launch the object out of the world.
|
|
882
|
+
*
|
|
883
|
+
* A very hard human throw is under ~15 m/s; a teleport across a room in one
|
|
884
|
+
* frame is hundreds. The gap is wide enough that one threshold separates them
|
|
885
|
+
* cleanly, and it also absorbs the frame-timing glitches that produce the same
|
|
886
|
+
* artefact on standalone headsets.
|
|
887
|
+
*/
|
|
888
|
+
declare const MAX_PLAUSIBLE_SPEED = 20;
|
|
875
889
|
type VelocitySample = {
|
|
876
890
|
position: THREE.Vector3;
|
|
877
891
|
/** Seconds, monotonically increasing. */
|
|
@@ -905,4 +919,4 @@ declare class ThrowVelocityTracker {
|
|
|
905
919
|
*/
|
|
906
920
|
declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
|
|
907
921
|
|
|
908
|
-
export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
|
|
922
|
+
export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -872,6 +872,20 @@ declare const VELOCITY_SAMPLES = 5;
|
|
|
872
872
|
* from before the pause.
|
|
873
873
|
*/
|
|
874
874
|
declare const MAX_SAMPLE_AGE_SECONDS = 0.2;
|
|
875
|
+
/**
|
|
876
|
+
* Fastest hand motion treated as real, in metres/second.
|
|
877
|
+
*
|
|
878
|
+
* Samples are recorded in WORLD space, so anything that moves the XR rig while
|
|
879
|
+
* an object is held — teleport, snap turn — relocates the hand instantly and
|
|
880
|
+
* implies an enormous velocity. Releasing after a teleport would otherwise
|
|
881
|
+
* launch the object out of the world.
|
|
882
|
+
*
|
|
883
|
+
* A very hard human throw is under ~15 m/s; a teleport across a room in one
|
|
884
|
+
* frame is hundreds. The gap is wide enough that one threshold separates them
|
|
885
|
+
* cleanly, and it also absorbs the frame-timing glitches that produce the same
|
|
886
|
+
* artefact on standalone headsets.
|
|
887
|
+
*/
|
|
888
|
+
declare const MAX_PLAUSIBLE_SPEED = 20;
|
|
875
889
|
type VelocitySample = {
|
|
876
890
|
position: THREE.Vector3;
|
|
877
891
|
/** Seconds, monotonically increasing. */
|
|
@@ -905,4 +919,4 @@ declare class ThrowVelocityTracker {
|
|
|
905
919
|
*/
|
|
906
920
|
declare function angularVelocityFrom(previous: THREE.Quaternion, current: THREE.Quaternion, deltaTime: number): THREE.Vector3;
|
|
907
921
|
|
|
908
|
-
export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
|
|
922
|
+
export { ADDED_NODE_MARKER_COMPONENT, ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, type ApplyPrefabToSnapshotResult, Behaviour, Component, type ComponentValueMaps, EcsEntityKind, EcsSystem, type EcsWorldComponentSnapshot, type EcsWorldStateSnapshotLike, EntityId, ExternalRefWarning, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, HYDRATABLE_ENTITY_KINDS, type HandMaterialOptions, type HydrateOptions, type HydrateWorldFromSnapshotResult, type InstantiateSubtreeResult, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, NODE_KEY_SEPARATOR, type NestedRegion, type NodeKeyMaps, type NodeMaps, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectManagementSystem, ParentLookup, SHARED_MODEL_RESOURCE_FLAG, ScriptObject, type SerializeEntitySubtreeResult, SpawnPrefabOptions, SpawnPrefabSource, SubtreeSnapshot, ThrowVelocityTracker, VELOCITY_SAMPLES, type VelocitySample, World, WorldEntityView, XrCapabilities, XrFinger, XrHandPoseDefinition, XrHandPoseEventDetail, XrHandPoseOrientation, XrInputState, angularVelocityFrom, applyHandMaterial, applyPrefabToSnapshotInstances, arcGroundCrossing, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearModelCache, cloneHandPose, collectDiffPaths, collectDirectPrefabDependencies, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, createHandMaterial, decanonicalizeComponentValue, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, getHandPosePreset, groupOverridePaths, handPoseFromCurls, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadSharedGltf, mergeComponentValue, parseOverride, resolveDracoDecoderPath, restoreComponentState, restorePostCreateComponents, sampleTeleportArc, serializeEntitySubtree, setDracoDecoderPath };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-
|
|
2
|
-
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_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, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, 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 } from './chunk-
|
|
1
|
+
import { MeshGeometrySystem, InstancedMeshSystem, EnvironmentSyncSystem, PostprocessingSyncSystem, LightSyncSystem, MaterialSyncSystem, VRTeleportAreaSystem, PhysicsSyncSystem, AnimationSystem, AudioSystem, VideoSystem, CameraSyncSystem, TransformSyncSystem, ObjectVisibilitySystem, RenderSystem, spawnPrefab, despawnPrefab, buildNodeKeyMapsFromSnapshot, indexSnapshotByEntity, findTopLevelNestedRegions, collectSnapshotSubtreeIds, groupOverridePaths, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, canonicalizeComponentValue, mergeComponentValue, decanonicalizeComponentValue, computeInstanceOverrides, collectEntitySubtree, ADDED_NODE_MARKER_COMPONENT } from './chunk-W5TSYV6Q.js';
|
|
2
|
+
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, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, 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 } from './chunk-W5TSYV6Q.js';
|
|
3
3
|
import { registerDefaultFactories } from './chunk-KIKIWCEB.js';
|
|
4
4
|
export { createAnimationComponent, createAudioComponent, createCameraComponent, createEntityTypeComponent, createEnvironmentComponent, createImageComponent, createImageTargetAnchorComponent, createImageTargetComponent, createInstanceSlotComponent, createInstancedMeshComponent, createLightComponent, createMaterialComponent, createMeshComponent, createMeshGeometryComponent, createModelComponent, createNameComponent, createObject3DRefComponent, createParentIdComponent, createPhysicsComponent, createPostprocessingComponent, createScriptComponent, createScriptObjectComponent, createSelectableComponent, createSelectionTransformStateComponent, createSpriteComponent, createTransformComponent, createVRTeleportAreaComponent, createVideoComponent, createXRHandPoseComponent, createXRInteractableComponent, createXRInteractorComponent, createXRInteractorSideComponent, createXRRigComponent, registerDefaultComponentFactories, registerDefaultFactories } from './chunk-KIKIWCEB.js';
|
|
5
5
|
import { ObjectManagementSystem } from './chunk-L5BP727H.js';
|
package/dist/systems/index.cjs
CHANGED
|
@@ -5277,13 +5277,9 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5277
5277
|
runtimeMessage: typeof entry.runtimeMessage === "string" ? entry.runtimeMessage : void 0
|
|
5278
5278
|
};
|
|
5279
5279
|
}).filter((entry) => entry.className || entry.scriptUrl) : [];
|
|
5280
|
-
if (
|
|
5281
|
-
|
|
5280
|
+
if (entries.length) {
|
|
5281
|
+
world.addComponent(targetEntityId, new ScriptComponent(entries));
|
|
5282
5282
|
}
|
|
5283
|
-
world.addComponent(
|
|
5284
|
-
targetEntityId,
|
|
5285
|
-
new ScriptComponent(entries)
|
|
5286
|
-
);
|
|
5287
5283
|
}
|
|
5288
5284
|
const sourceScriptObject = asRecord3(values.scriptObjectValues.get(sourceEntityId));
|
|
5289
5285
|
if (sourceScriptObject) {
|
|
@@ -5332,10 +5328,14 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5332
5328
|
const sourceInteractable = asRecord3(
|
|
5333
5329
|
values.xrInteractableValues.get(sourceEntityId)
|
|
5334
5330
|
);
|
|
5335
|
-
|
|
5331
|
+
let interactable = world.getComponent(
|
|
5336
5332
|
targetEntityId,
|
|
5337
5333
|
XRInteractableComponent
|
|
5338
5334
|
);
|
|
5335
|
+
if (sourceInteractable && !interactable) {
|
|
5336
|
+
interactable = new XRInteractableComponent();
|
|
5337
|
+
world.addComponent(targetEntityId, interactable);
|
|
5338
|
+
}
|
|
5339
5339
|
if (sourceInteractable && interactable) {
|
|
5340
5340
|
if (typeof sourceInteractable.enabled === "boolean") {
|
|
5341
5341
|
interactable.enabled = sourceInteractable.enabled;
|
|
@@ -5392,7 +5392,11 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5392
5392
|
const sourceHandPose = asRecord3(
|
|
5393
5393
|
values.xrHandPoseValues.get(sourceEntityId)
|
|
5394
5394
|
);
|
|
5395
|
-
|
|
5395
|
+
let handPose = world.getComponent(targetEntityId, XRHandPoseComponent);
|
|
5396
|
+
if (sourceHandPose && !handPose) {
|
|
5397
|
+
handPose = new XRHandPoseComponent();
|
|
5398
|
+
world.addComponent(targetEntityId, handPose);
|
|
5399
|
+
}
|
|
5396
5400
|
if (sourceHandPose && handPose) {
|
|
5397
5401
|
if (typeof sourceHandPose.enabled === "boolean") {
|
|
5398
5402
|
handPose.enabled = sourceHandPose.enabled;
|
|
@@ -8200,6 +8204,7 @@ __name(_XRInputSystem, "XRInputSystem");
|
|
|
8200
8204
|
var XRInputSystem = _XRInputSystem;
|
|
8201
8205
|
var VELOCITY_SAMPLES = 5;
|
|
8202
8206
|
var MAX_SAMPLE_AGE_SECONDS = 0.2;
|
|
8207
|
+
var MAX_PLAUSIBLE_SPEED = 20;
|
|
8203
8208
|
var _ThrowVelocityTracker = class _ThrowVelocityTracker {
|
|
8204
8209
|
constructor() {
|
|
8205
8210
|
this.samples = [];
|
|
@@ -8233,6 +8238,7 @@ var _ThrowVelocityTracker = class _ThrowVelocityTracker {
|
|
|
8233
8238
|
if (dt <= 1e-5) continue;
|
|
8234
8239
|
const velocity = new THREE14__namespace.Vector3().subVectors(current.position, previous.position).divideScalar(dt);
|
|
8235
8240
|
const speed = velocity.length();
|
|
8241
|
+
if (speed > MAX_PLAUSIBLE_SPEED) continue;
|
|
8236
8242
|
if (speed > bestSpeed) {
|
|
8237
8243
|
bestSpeed = speed;
|
|
8238
8244
|
best = velocity;
|
|
@@ -8382,7 +8388,9 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8382
8388
|
if (!interactable?.enabled) continue;
|
|
8383
8389
|
if (!world.isEntityVisible(entityId)) continue;
|
|
8384
8390
|
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
8385
|
-
if (object)
|
|
8391
|
+
if (object) {
|
|
8392
|
+
out.push({ entityId, object, pointable: interactable.pointable });
|
|
8393
|
+
}
|
|
8386
8394
|
}
|
|
8387
8395
|
return out;
|
|
8388
8396
|
}
|
|
@@ -8394,6 +8402,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8394
8402
|
let nearestId = null;
|
|
8395
8403
|
let nearestDistance = Number.POSITIVE_INFINITY;
|
|
8396
8404
|
for (const entry of interactables) {
|
|
8405
|
+
if (!entry.pointable) continue;
|
|
8397
8406
|
const hit = this.raycaster.intersectObject(entry.object, true)[0];
|
|
8398
8407
|
if (!hit) continue;
|
|
8399
8408
|
if (hit.distance < nearestDistance) {
|