@relu-interactives/spatial-ecs 0.3.10 → 0.3.12
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-hAtj9wm-.d.cts → XRHandPose-DawOR0uR.d.cts} +56 -14
- package/dist/{XRHandPose-CjacJ_16.d.ts → XRHandPose-DhAd9Qi6.d.ts} +56 -14
- package/dist/{chunk-NJOO7NO6.js → chunk-7ZIN6TGT.js} +3 -3
- package/dist/{chunk-NJOO7NO6.js.map → chunk-7ZIN6TGT.js.map} +1 -1
- package/dist/{chunk-5UVBEAGW.js → chunk-ID7U4FER.js} +4 -4
- package/dist/{chunk-5UVBEAGW.js.map → chunk-ID7U4FER.js.map} +1 -1
- package/dist/{chunk-O2HSIZFC.js → chunk-LCJ6IH2O.js} +324 -47
- package/dist/chunk-LCJ6IH2O.js.map +1 -0
- package/dist/{chunk-ELSZ5U3F.js → chunk-OMDYLFTN.js} +7 -4
- package/dist/chunk-OMDYLFTN.js.map +1 -0
- package/dist/components/index.cjs +5 -2
- 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 +7 -3
- package/dist/factories/index.cjs +5 -2
- 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-B7JDsx4a.d.ts → index-B49322Q3.d.ts} +2 -3
- package/dist/{index-DU-CF-3m.d.cts → index-DJ9bn9SF.d.cts} +70 -1
- package/dist/{index-B-KhN8Ox.d.ts → index-M0I5B3JA.d.ts} +70 -1
- package/dist/{index-B9JqYr3Q.d.cts → index-Xm3im4Pt.d.cts} +2 -3
- package/dist/index.cjs +326 -44
- 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 +326 -44
- 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-ELSZ5U3F.js.map +0 -1
- package/dist/chunk-O2HSIZFC.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { k as EcsSystem, C as Component, W as WorldEntityView, T as TransformComponent, l as World, S as SpawnPrefabSource, m as SpawnPrefabOptions, n as ComponentClass, o as ParentLookup, p as EcsEntityKind, O as ObjectManagementSystem, q as SubtreeSnapshot, r as EntityId, s as ExternalRefWarning } from './System-31wk-A0g.cjs';
|
|
2
2
|
export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFactory, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, B as EcsComponentFactoryKind, F as EcsEntityEditorKind, G as EntityInput, H as FloatInput, I as InputSystem, J as IntersectionResult, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, N as PREFAB_FILE_VERSION, Q as PREFAB_FILE_VERSION_NESTED, R as PrefabAsset, U as RemapSnapshotOptions, X as RenderSystem, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a0 as TransformSyncSystem, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, a4 as clearPrefabCache, a5 as despawnPrefab, a6 as loadPrefab, a7 as parsePrefabAsset, a8 as prefabFileVersionFor, a9 as remapSnapshotEntityIds, aa as setPrefabAssetUrlResolver, ab as spawnPrefab } from './System-31wk-A0g.cjs';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { O as Object3DRef,
|
|
5
|
-
export {
|
|
6
|
-
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-
|
|
7
|
-
export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as
|
|
8
|
-
export { i as CoreComponents } from './index-
|
|
4
|
+
import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-DawOR0uR.cjs';
|
|
5
|
+
export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-DawOR0uR.cjs';
|
|
6
|
+
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-DJ9bn9SF.cjs';
|
|
7
|
+
export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-DJ9bn9SF.cjs';
|
|
8
|
+
export { i as CoreComponents } from './index-Xm3im4Pt.cjs';
|
|
9
9
|
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 './factories/index.cjs';
|
|
10
10
|
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
11
11
|
import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { k as EcsSystem, C as Component, W as WorldEntityView, T as TransformComponent, l as World, S as SpawnPrefabSource, m as SpawnPrefabOptions, n as ComponentClass, o as ParentLookup, p as EcsEntityKind, O as ObjectManagementSystem, q as SubtreeSnapshot, r as EntityId, s as ExternalRefWarning } from './System-31wk-A0g.js';
|
|
2
2
|
export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFactory, w as ComponentInput, x as ComponentKind, y as DropdownInput, z as DropdownOption, B as EcsComponentFactoryKind, F as EcsEntityEditorKind, G as EntityInput, H as FloatInput, I as InputSystem, J as IntersectionResult, K as KeyboardKey, L as KeyboardKeys, M as MouseButton, N as PREFAB_FILE_VERSION, Q as PREFAB_FILE_VERSION_NESTED, R as PrefabAsset, U as RemapSnapshotOptions, X as RenderSystem, Y as SelectionListener, Z as SliderInput, _ as TextInput, $ as ToggleInput, a0 as TransformSyncSystem, a1 as Vec3, a2 as Vector2Input, a3 as Vector3Input, a4 as clearPrefabCache, a5 as despawnPrefab, a6 as loadPrefab, a7 as parsePrefabAsset, a8 as prefabFileVersionFor, a9 as remapSnapshotEntityIds, aa as setPrefabAssetUrlResolver, ab as spawnPrefab } from './System-31wk-A0g.js';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
-
import { O as Object3DRef,
|
|
5
|
-
export {
|
|
6
|
-
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-
|
|
7
|
-
export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as
|
|
8
|
-
export { i as CoreComponents } from './index-
|
|
4
|
+
import { O as Object3DRef, an as XrHandPreset } from './XRHandPose-DhAd9Qi6.js';
|
|
5
|
+
export { az as AnimationStateCallbacks, aA as AnimationStateMachine, aB as AnimationStateManager, aC as StateMachine } from './XRHandPose-DhAd9Qi6.js';
|
|
6
|
+
import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-M0I5B3JA.js';
|
|
7
|
+
export { A as AnimationSystem, c as AudioSystem, C as CameraSyncSystem, E as EnvironmentSyncSystem, I as InstancedMeshSystem, L as LightSyncSystem, M as MaterialSyncSystem, d as MeshGeometrySystem, e as ModuleLoader, N as NO_XR_CAPABILITIES, O as ObjectVisibilitySystem, P as PhysicsSyncSystem, f as PostprocessingSyncSystem, S as SCRIPT_OBJECT_ROOT_FLAG, g as ScriptBehaviourSystem, h as ScriptObjectSystem, i as SelectionContext, V as VRTeleportAreaSystem, j as VideoSystem, k as XRControllerVisualSystem, l as XRHandPoseSystem, m as XRHoverVisualSystem, n as XRInputSystem, o as XRInteractionSystem, p as XRLocomotionSystem, q as XRSessionSystem, r as XRTeleportVisualSystem, s as XR_HOVER_SHELL_FLAG, t as XrHandedness, u as XrInputKind, v as readXrCapabilities } from './index-M0I5B3JA.js';
|
|
8
|
+
export { i as CoreComponents } from './index-B49322Q3.js';
|
|
9
9
|
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 './factories/index.js';
|
|
10
10
|
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
11
11
|
import { X as XrHandPoseDefinition, a as XrFinger, b as XrHandPoseOrientation } from './handPose-dFxqbFFY.js';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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_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-
|
|
3
|
-
import { registerDefaultFactories } from './chunk-
|
|
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-
|
|
5
|
-
import { ObjectManagementSystem } from './chunk-
|
|
6
|
-
export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-
|
|
7
|
-
import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-
|
|
8
|
-
export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } 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-LCJ6IH2O.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, 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 } from './chunk-LCJ6IH2O.js';
|
|
3
|
+
import { registerDefaultFactories } from './chunk-ID7U4FER.js';
|
|
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-ID7U4FER.js';
|
|
5
|
+
import { ObjectManagementSystem } from './chunk-7ZIN6TGT.js';
|
|
6
|
+
export { ObjectManagementSystem, SHARED_MODEL_RESOURCE_FLAG, clearModelCache, loadSharedGltf, resolveDracoDecoderPath, setDracoDecoderPath } from './chunk-7ZIN6TGT.js';
|
|
7
|
+
import { SelectionTransformState, Object3DRef, Name, EntityType, ParentId, Environment, Postprocessing, ScriptComponent } from './chunk-OMDYLFTN.js';
|
|
8
|
+
export { AnimationStateMachine, AnimationStateManager, components_exports as CoreComponents, HAND_POSE_PRESETS, HAND_POSE_PRESET_IDS, cloneHandPose, getHandPosePreset, handPoseFromCurls } from './chunk-OMDYLFTN.js';
|
|
9
9
|
import './chunk-QHILSPT4.js';
|
|
10
10
|
import { normalizeDebugValue, DEBUG_CHANGE_IGNORED_SYSTEMS, cloneHistoryValue } from './chunk-OWQSESTO.js';
|
|
11
11
|
import { __name } from './chunk-OY7ZODZP.js';
|
package/dist/systems/index.cjs
CHANGED
|
@@ -2098,7 +2098,6 @@ var _XRInteractableComponent = class _XRInteractableComponent extends Component
|
|
|
2098
2098
|
this.enabled = options?.enabled ?? true;
|
|
2099
2099
|
this.grabbable = options?.grabbable ?? true;
|
|
2100
2100
|
this.pointable = options?.pointable ?? true;
|
|
2101
|
-
this.grabMode = options?.grabMode ?? "kinematic";
|
|
2102
2101
|
this.grabReach = options?.grabReach ?? "both";
|
|
2103
2102
|
this.distanceBehavior = options?.distanceBehavior ?? "snap";
|
|
2104
2103
|
this.grabGesture = options?.grabGesture ?? "any";
|
|
@@ -2123,7 +2122,9 @@ var _XRInteractableComponent = class _XRInteractableComponent extends Component
|
|
|
2123
2122
|
);
|
|
2124
2123
|
this.throwOnRelease = options?.throwOnRelease ?? true;
|
|
2125
2124
|
this.throwStrength = options?.throwStrength ?? 1;
|
|
2126
|
-
this.
|
|
2125
|
+
this.hoverBehavior = options?.hoverBehavior ?? "color";
|
|
2126
|
+
this.hoverColor = options?.hoverColor ?? "#4da3ff";
|
|
2127
|
+
this.hoverScale = options?.hoverScale ?? 1.06;
|
|
2127
2128
|
}
|
|
2128
2129
|
};
|
|
2129
2130
|
__name(_XRInteractableComponent, "XRInteractableComponent");
|
|
@@ -2165,6 +2166,8 @@ var _XRInteractorComponent = class _XRInteractorComponent extends Component {
|
|
|
2165
2166
|
this.handOpacity = options?.handOpacity ?? 1;
|
|
2166
2167
|
this.handEmissiveIntensity = options?.handEmissiveIntensity ?? 0;
|
|
2167
2168
|
this.showRay = options?.showRay ?? true;
|
|
2169
|
+
this.rayColor = options?.rayColor ?? "#4da3ff";
|
|
2170
|
+
this.rayThickness = options?.rayThickness ?? 6e-3;
|
|
2168
2171
|
}
|
|
2169
2172
|
};
|
|
2170
2173
|
__name(_XRInteractorComponent, "XRInteractorComponent");
|
|
@@ -3285,6 +3288,20 @@ var _PostprocessingSyncSystem = class _PostprocessingSyncSystem {
|
|
|
3285
3288
|
__name(_PostprocessingSyncSystem, "PostprocessingSyncSystem");
|
|
3286
3289
|
var PostprocessingSyncSystem = _PostprocessingSyncSystem;
|
|
3287
3290
|
var MIN_SIZE = 1e-4;
|
|
3291
|
+
function toBodyType(RAPIER, bodyType) {
|
|
3292
|
+
switch (bodyType) {
|
|
3293
|
+
case "fixed":
|
|
3294
|
+
return RAPIER.RigidBodyType.Fixed;
|
|
3295
|
+
case "kinematicPosition":
|
|
3296
|
+
return RAPIER.RigidBodyType.KinematicPositionBased;
|
|
3297
|
+
case "kinematicVelocity":
|
|
3298
|
+
return RAPIER.RigidBodyType.KinematicVelocityBased;
|
|
3299
|
+
case "dynamic":
|
|
3300
|
+
default:
|
|
3301
|
+
return RAPIER.RigidBodyType.Dynamic;
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
__name(toBodyType, "toBodyType");
|
|
3288
3305
|
function createRigidBodyDesc(RAPIER, bodyType) {
|
|
3289
3306
|
if (bodyType === "fixed") {
|
|
3290
3307
|
return RAPIER.RigidBodyDesc.fixed();
|
|
@@ -3583,7 +3600,8 @@ var _PhysicsSyncSystem = class _PhysicsSyncSystem {
|
|
|
3583
3600
|
setPhysicsLiveRef(physics, "collider", null);
|
|
3584
3601
|
continue;
|
|
3585
3602
|
}
|
|
3586
|
-
const
|
|
3603
|
+
const { type: _desiredBodyType, ...rigidBodyRebuildValues } = physics.values.rigidbody;
|
|
3604
|
+
const rigidBodySignature = JSON.stringify(rigidBodyRebuildValues);
|
|
3587
3605
|
const previousRigidBodySignature = this.rigidBodySignatures.get(entityId);
|
|
3588
3606
|
const hasRigidBody = this.rigidBodyHandles.has(entityId);
|
|
3589
3607
|
const shouldRecreateBody = !hasRigidBody || previousRigidBodySignature !== rigidBodySignature;
|
|
@@ -3638,6 +3656,25 @@ var _PhysicsSyncSystem = class _PhysicsSyncSystem {
|
|
|
3638
3656
|
continue;
|
|
3639
3657
|
}
|
|
3640
3658
|
setPhysicsLiveRef(physics, "rigidBody", body);
|
|
3659
|
+
const desiredBodyType = this.isEditorMode ? "fixed" : physics.values.rigidbody.type;
|
|
3660
|
+
const desiredRapierType = toBodyType(this.rapier, desiredBodyType);
|
|
3661
|
+
if (body.bodyType() !== desiredRapierType) {
|
|
3662
|
+
body.setBodyType(desiredRapierType, true);
|
|
3663
|
+
if (!this.isEditorMode && desiredBodyType === "dynamic") {
|
|
3664
|
+
body.setAdditionalMass(physics.values.rigidbody.mass, true);
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
const pending = physics.pendingVelocity;
|
|
3668
|
+
if (pending) {
|
|
3669
|
+
setPhysicsLiveRef(physics, "pendingVelocity", null);
|
|
3670
|
+
if (!this.isEditorMode && desiredBodyType === "dynamic") {
|
|
3671
|
+
try {
|
|
3672
|
+
body.setLinvel(pending.linear, true);
|
|
3673
|
+
body.setAngvel(pending.angular, true);
|
|
3674
|
+
} catch {
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3641
3678
|
if (this.isEditorMode || physics.values.rigidbody.type !== "dynamic") {
|
|
3642
3679
|
syncBodyFromTransform(body, transform);
|
|
3643
3680
|
}
|
|
@@ -5365,9 +5402,6 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5365
5402
|
if (typeof sourceInteractable.pointable === "boolean") {
|
|
5366
5403
|
interactable.pointable = sourceInteractable.pointable;
|
|
5367
5404
|
}
|
|
5368
|
-
if (typeof sourceInteractable.grabMode === "string") {
|
|
5369
|
-
interactable.grabMode = sourceInteractable.grabMode;
|
|
5370
|
-
}
|
|
5371
5405
|
if (typeof sourceInteractable.grabReach === "string") {
|
|
5372
5406
|
interactable.grabReach = sourceInteractable.grabReach;
|
|
5373
5407
|
}
|
|
@@ -5426,8 +5460,16 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5426
5460
|
z: typeof grabRot.z === "number" ? grabRot.z : 0
|
|
5427
5461
|
};
|
|
5428
5462
|
}
|
|
5429
|
-
if (typeof sourceInteractable.
|
|
5430
|
-
interactable.
|
|
5463
|
+
if (typeof sourceInteractable.hoverBehavior === "string") {
|
|
5464
|
+
interactable.hoverBehavior = sourceInteractable.hoverBehavior;
|
|
5465
|
+
} else if (sourceInteractable.highlightOnHover === false) {
|
|
5466
|
+
interactable.hoverBehavior = "none";
|
|
5467
|
+
}
|
|
5468
|
+
if (typeof sourceInteractable.hoverColor === "string") {
|
|
5469
|
+
interactable.hoverColor = sourceInteractable.hoverColor;
|
|
5470
|
+
}
|
|
5471
|
+
if (typeof sourceInteractable.hoverScale === "number") {
|
|
5472
|
+
interactable.hoverScale = sourceInteractable.hoverScale;
|
|
5431
5473
|
}
|
|
5432
5474
|
}
|
|
5433
5475
|
}
|
|
@@ -5479,6 +5521,12 @@ function restorePostCreateComponents(world, objectManagementSystem, targetEntity
|
|
|
5479
5521
|
if (typeof sourceInteractor.showRay === "boolean") {
|
|
5480
5522
|
interactor.showRay = sourceInteractor.showRay;
|
|
5481
5523
|
}
|
|
5524
|
+
if (typeof sourceInteractor.rayColor === "string") {
|
|
5525
|
+
interactor.rayColor = sourceInteractor.rayColor;
|
|
5526
|
+
}
|
|
5527
|
+
if (typeof sourceInteractor.rayThickness === "number") {
|
|
5528
|
+
interactor.rayThickness = sourceInteractor.rayThickness;
|
|
5529
|
+
}
|
|
5482
5530
|
}
|
|
5483
5531
|
}
|
|
5484
5532
|
{
|
|
@@ -8378,6 +8426,8 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8378
8426
|
this.raycaster = new THREE26__namespace.Raycaster();
|
|
8379
8427
|
this.grabs = /* @__PURE__ */ new Map();
|
|
8380
8428
|
this.hoveredEntityId = null;
|
|
8429
|
+
/** Per-hand hover, with the hit distance so the ray can stop at the surface. */
|
|
8430
|
+
this.hovers = /* @__PURE__ */ new Map();
|
|
8381
8431
|
/** Monotonic seconds, accumulated from deltaTime for velocity sampling. */
|
|
8382
8432
|
this.elapsed = 0;
|
|
8383
8433
|
this.inputSystem = inputSystem;
|
|
@@ -8391,6 +8441,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8391
8441
|
const inputs = this.inputSystem.getInputs();
|
|
8392
8442
|
const interactables = this.collectInteractables(world);
|
|
8393
8443
|
this.hoveredEntityId = null;
|
|
8444
|
+
this.hovers.clear();
|
|
8394
8445
|
for (const input of inputs) {
|
|
8395
8446
|
if (!input.connected) {
|
|
8396
8447
|
this.release(world, input);
|
|
@@ -8408,6 +8459,10 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8408
8459
|
if (this.hoveredEntityId === null) {
|
|
8409
8460
|
this.hoveredEntityId = candidate.entityId;
|
|
8410
8461
|
}
|
|
8462
|
+
this.hovers.set(input, {
|
|
8463
|
+
entityId: candidate.entityId,
|
|
8464
|
+
distance: candidate.distance
|
|
8465
|
+
});
|
|
8411
8466
|
const interactable = world.getComponent(
|
|
8412
8467
|
candidate.entityId,
|
|
8413
8468
|
XRInteractableComponent
|
|
@@ -8480,7 +8535,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8480
8535
|
transform.position.x - hand.x,
|
|
8481
8536
|
transform.position.y - hand.y,
|
|
8482
8537
|
transform.position.z - hand.z
|
|
8483
|
-
);
|
|
8538
|
+
).applyQuaternion(handQuaternion.clone().invert());
|
|
8484
8539
|
record.handRotationOffset = handQuaternion.clone().invert().multiply(objectQuaternion);
|
|
8485
8540
|
record.remote = false;
|
|
8486
8541
|
record.tracker.clear();
|
|
@@ -8591,13 +8646,22 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8591
8646
|
}
|
|
8592
8647
|
}
|
|
8593
8648
|
if (nearestId !== null) {
|
|
8594
|
-
return {
|
|
8649
|
+
return {
|
|
8650
|
+
entityId: nearestId,
|
|
8651
|
+
viaDistance: false,
|
|
8652
|
+
distance: nearestDistance
|
|
8653
|
+
};
|
|
8595
8654
|
}
|
|
8596
|
-
const
|
|
8597
|
-
if (
|
|
8655
|
+
const hit = this.raycast(input, interactables);
|
|
8656
|
+
if (hit === null) return null;
|
|
8657
|
+
const hitId = hit.entityId;
|
|
8598
8658
|
const interactable = world.getComponent(hitId, XRInteractableComponent);
|
|
8599
8659
|
const viaDistanceAllowed = interactable?.grabReach === "distance" || interactable?.grabReach === "both";
|
|
8600
|
-
return {
|
|
8660
|
+
return {
|
|
8661
|
+
entityId: hitId,
|
|
8662
|
+
viaDistance: viaDistanceAllowed,
|
|
8663
|
+
distance: hit.distance
|
|
8664
|
+
};
|
|
8601
8665
|
}
|
|
8602
8666
|
collectInteractables(world) {
|
|
8603
8667
|
const out = [];
|
|
@@ -8628,7 +8692,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8628
8692
|
nearestId = entry.entityId;
|
|
8629
8693
|
}
|
|
8630
8694
|
}
|
|
8631
|
-
return nearestId;
|
|
8695
|
+
return nearestId === null ? null : { entityId: nearestId, distance: nearestDistance };
|
|
8632
8696
|
}
|
|
8633
8697
|
/**
|
|
8634
8698
|
* Pick the authored hold this hand should take.
|
|
@@ -8703,7 +8767,7 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8703
8767
|
transform.position.x - hand.x,
|
|
8704
8768
|
transform.position.y - hand.y,
|
|
8705
8769
|
transform.position.z - hand.z
|
|
8706
|
-
);
|
|
8770
|
+
).applyQuaternion(handQuaternion.clone().invert());
|
|
8707
8771
|
}
|
|
8708
8772
|
const physics = world.getComponent(entityId, PhysicsComponent);
|
|
8709
8773
|
let restoreBodyType = null;
|
|
@@ -8838,9 +8902,10 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8838
8902
|
transform.position.z = hand.z - anchor.z;
|
|
8839
8903
|
writeEuler(transform.rotation, objectQuaternion);
|
|
8840
8904
|
} else {
|
|
8841
|
-
|
|
8842
|
-
transform.position.
|
|
8843
|
-
transform.position.
|
|
8905
|
+
const carried = held.offset.clone().applyQuaternion(handQuaternion);
|
|
8906
|
+
transform.position.x = hand.x + carried.x;
|
|
8907
|
+
transform.position.y = hand.y + carried.y;
|
|
8908
|
+
transform.position.z = hand.z + carried.z;
|
|
8844
8909
|
writeEuler(transform.rotation, objectQuaternion);
|
|
8845
8910
|
}
|
|
8846
8911
|
held.tracker.record(
|
|
@@ -8893,19 +8958,14 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8893
8958
|
const physics = world.getComponent(held.entityId, PhysicsComponent);
|
|
8894
8959
|
if (held.restoreBodyType !== null && physics) {
|
|
8895
8960
|
physics.values.rigidbody.type = held.restoreBodyType;
|
|
8896
|
-
const body = physics.rigidBody;
|
|
8897
8961
|
const dynamic = held.restoreBodyType === "dynamic";
|
|
8898
|
-
if (
|
|
8962
|
+
if (dynamic && interactable?.throwOnRelease) {
|
|
8899
8963
|
const velocity = held.tracker.computeVelocity(this.elapsed).multiplyScalar(interactable.throwStrength);
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
const spin = held.angularVelocity;
|
|
8906
|
-
body.setAngvel({ x: spin.x, y: spin.y, z: spin.z }, true);
|
|
8907
|
-
} catch {
|
|
8908
|
-
}
|
|
8964
|
+
const spin = held.angularVelocity;
|
|
8965
|
+
setPhysicsLiveRef(physics, "pendingVelocity", {
|
|
8966
|
+
linear: { x: velocity.x, y: velocity.y, z: velocity.z },
|
|
8967
|
+
angular: { x: spin.x, y: spin.y, z: spin.z }
|
|
8968
|
+
});
|
|
8909
8969
|
}
|
|
8910
8970
|
}
|
|
8911
8971
|
held.tracker.clear();
|
|
@@ -8953,10 +9013,41 @@ var _XRInteractionSystem = class _XRInteractionSystem {
|
|
|
8953
9013
|
getHoveredEntityId() {
|
|
8954
9014
|
return this.hoveredEntityId;
|
|
8955
9015
|
}
|
|
9016
|
+
/**
|
|
9017
|
+
* What this hand is pointing at, with the distance to it.
|
|
9018
|
+
*
|
|
9019
|
+
* The distance is what lets the pointer ray stop at the surface instead of
|
|
9020
|
+
* passing through the object.
|
|
9021
|
+
*/
|
|
9022
|
+
getHoverFor(handedness) {
|
|
9023
|
+
for (const [input, hover] of this.hovers) {
|
|
9024
|
+
if (input.handedness === handedness) return hover;
|
|
9025
|
+
}
|
|
9026
|
+
return null;
|
|
9027
|
+
}
|
|
9028
|
+
/** Every entity under a pointer this frame — drives hover feedback. */
|
|
9029
|
+
getHoveredEntityIds() {
|
|
9030
|
+
const ids = /* @__PURE__ */ new Set();
|
|
9031
|
+
for (const hover of this.hovers.values()) ids.add(hover.entityId);
|
|
9032
|
+
return ids;
|
|
9033
|
+
}
|
|
9034
|
+
/** Entities currently held, so hover feedback can skip them. */
|
|
9035
|
+
getHeldEntityIds() {
|
|
9036
|
+
const ids = /* @__PURE__ */ new Set();
|
|
9037
|
+
for (const record of this.grabs.values()) ids.add(record.entityId);
|
|
9038
|
+
return ids;
|
|
9039
|
+
}
|
|
8956
9040
|
/** True when any source is holding something. */
|
|
8957
9041
|
isGrabbing() {
|
|
8958
9042
|
return this.grabs.size > 0;
|
|
8959
9043
|
}
|
|
9044
|
+
/** True when THIS hand is holding something. */
|
|
9045
|
+
isGrabbingWith(handedness) {
|
|
9046
|
+
for (const input of this.grabs.keys()) {
|
|
9047
|
+
if (input.handedness === handedness) return true;
|
|
9048
|
+
}
|
|
9049
|
+
return false;
|
|
9050
|
+
}
|
|
8960
9051
|
/**
|
|
8961
9052
|
* How an entity is currently held.
|
|
8962
9053
|
*
|
|
@@ -9500,6 +9591,10 @@ function applyHandMaterial(root, material) {
|
|
|
9500
9591
|
});
|
|
9501
9592
|
}
|
|
9502
9593
|
__name(applyHandMaterial, "applyHandMaterial");
|
|
9594
|
+
|
|
9595
|
+
// core/systems/XRControllerVisualSystem.ts
|
|
9596
|
+
var RAY_LENGTH = 5;
|
|
9597
|
+
var RAY_RADIUS = 3e-3;
|
|
9503
9598
|
var SLOTS = [
|
|
9504
9599
|
{ index: 0, side: "left" },
|
|
9505
9600
|
{ index: 1, side: "right" }
|
|
@@ -9509,6 +9604,8 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
9509
9604
|
this.controllerModelFactory = new XRControllerModelFactory_js.XRControllerModelFactory();
|
|
9510
9605
|
this.handModelFactory = new XRHandModelFactory_js.XRHandModelFactory();
|
|
9511
9606
|
this.group = new THREE26__namespace.Group();
|
|
9607
|
+
/** Reused so a per-frame colour compare allocates nothing. */
|
|
9608
|
+
this.rayColorScratch = new THREE26__namespace.Color();
|
|
9512
9609
|
this.slots = /* @__PURE__ */ new Map();
|
|
9513
9610
|
this.attachedTo = null;
|
|
9514
9611
|
/** Last applied preset signature, so materials rebuild only on real change. */
|
|
@@ -9537,7 +9634,9 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
9537
9634
|
const hasHand = liveKind === null || liveKind === "hand";
|
|
9538
9635
|
visuals.controllerModel.visible = showControllers && hasController;
|
|
9539
9636
|
visuals.handModel.visible = showHands && hasHand;
|
|
9540
|
-
visuals.ray.visible = this.shouldShowRay(interactor);
|
|
9637
|
+
visuals.ray.visible = this.shouldShowRay(interactor, side);
|
|
9638
|
+
this.fitRayToHover(visuals.ray, side);
|
|
9639
|
+
this.applyRayStyle(visuals.ray, interactor);
|
|
9541
9640
|
if (showHands && this.handMaterial) {
|
|
9542
9641
|
applyHandMaterial(visuals.handModel, this.handMaterial);
|
|
9543
9642
|
}
|
|
@@ -9613,10 +9712,35 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
9613
9712
|
* off entirely; otherwise it appears on hover/grab so it isn't permanent
|
|
9614
9713
|
* clutter implying the whole scene is clickable.
|
|
9615
9714
|
*/
|
|
9616
|
-
shouldShowRay(interactor) {
|
|
9715
|
+
shouldShowRay(interactor, side) {
|
|
9617
9716
|
if (interactor && !interactor.showRay) return false;
|
|
9618
9717
|
if (!this.interactionSystem) return true;
|
|
9619
|
-
return this.interactionSystem.
|
|
9718
|
+
return this.interactionSystem.getHoverFor(side) !== null || this.interactionSystem.isGrabbingWith(side);
|
|
9719
|
+
}
|
|
9720
|
+
/** Push the author's ray colour and thickness onto the mesh. */
|
|
9721
|
+
applyRayStyle(ray, interactor) {
|
|
9722
|
+
if (!interactor) return;
|
|
9723
|
+
const material = ray.material;
|
|
9724
|
+
if (material?.color && !material.color.equals(this.rayColorScratch.set(interactor.rayColor))) {
|
|
9725
|
+
material.color.copy(this.rayColorScratch);
|
|
9726
|
+
}
|
|
9727
|
+
const radius = Math.max(5e-4, interactor.rayThickness / 2) / RAY_RADIUS;
|
|
9728
|
+
if (ray.scale.x !== radius) {
|
|
9729
|
+
ray.scale.x = radius;
|
|
9730
|
+
ray.scale.y = radius;
|
|
9731
|
+
}
|
|
9732
|
+
}
|
|
9733
|
+
/**
|
|
9734
|
+
* Stop the ray at whatever it is pointing at.
|
|
9735
|
+
*
|
|
9736
|
+
* A fixed-length ray drawn with depth testing off punches straight through the
|
|
9737
|
+
* object, so the user cannot tell where the pointer actually lands. Scaling it
|
|
9738
|
+
* to the hit distance turns it into a pointer that meets the surface.
|
|
9739
|
+
*/
|
|
9740
|
+
fitRayToHover(ray, side) {
|
|
9741
|
+
const hover = this.interactionSystem?.getHoverFor(side) ?? null;
|
|
9742
|
+
const length = hover && Number.isFinite(hover.distance) && hover.distance > 0 ? Math.min(hover.distance, RAY_LENGTH) : RAY_LENGTH;
|
|
9743
|
+
ray.scale.z = length;
|
|
9620
9744
|
}
|
|
9621
9745
|
/** Lazily build per-slot visuals; the device reports profiles late. */
|
|
9622
9746
|
ensureSlots(world) {
|
|
@@ -9656,22 +9780,32 @@ var _XRControllerVisualSystem = class _XRControllerVisualSystem {
|
|
|
9656
9780
|
target.add(this.group);
|
|
9657
9781
|
this.attachedTo = target;
|
|
9658
9782
|
}
|
|
9783
|
+
/**
|
|
9784
|
+
* The pointer ray.
|
|
9785
|
+
*
|
|
9786
|
+
* A cylinder rather than a `THREE.Line`, because WebGL ignores `linewidth` —
|
|
9787
|
+
* every line renders one pixel wide regardless, which is nearly invisible on a
|
|
9788
|
+
* headset. A thin mesh is the only way to get a ray with real thickness
|
|
9789
|
+
* without pulling in a line-rendering extension.
|
|
9790
|
+
*/
|
|
9659
9791
|
createRay() {
|
|
9660
|
-
const geometry = new THREE26__namespace.
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
const material = new THREE26__namespace.LineBasicMaterial({
|
|
9792
|
+
const geometry = new THREE26__namespace.CylinderGeometry(RAY_RADIUS, RAY_RADIUS, 1, 8, 1);
|
|
9793
|
+
geometry.rotateX(-Math.PI / 2);
|
|
9794
|
+
geometry.translate(0, 0, -0.5);
|
|
9795
|
+
const material = new THREE26__namespace.MeshBasicMaterial({
|
|
9665
9796
|
color: "#4da3ff",
|
|
9666
9797
|
transparent: true,
|
|
9667
|
-
opacity: 0.
|
|
9668
|
-
depthTest: false
|
|
9798
|
+
opacity: 0.75,
|
|
9799
|
+
depthTest: false,
|
|
9800
|
+
depthWrite: false
|
|
9669
9801
|
});
|
|
9670
|
-
const
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9802
|
+
const mesh = new THREE26__namespace.Mesh(geometry, material);
|
|
9803
|
+
mesh.name = "XRPointerRay";
|
|
9804
|
+
mesh.renderOrder = 999;
|
|
9805
|
+
mesh.visible = false;
|
|
9806
|
+
mesh.raycast = () => {
|
|
9807
|
+
};
|
|
9808
|
+
return mesh;
|
|
9675
9809
|
}
|
|
9676
9810
|
dispose() {
|
|
9677
9811
|
this.group.removeFromParent();
|
|
@@ -10322,6 +10456,152 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
|
|
|
10322
10456
|
};
|
|
10323
10457
|
__name(_XRHandPoseSystem, "XRHandPoseSystem");
|
|
10324
10458
|
var XRHandPoseSystem = _XRHandPoseSystem;
|
|
10459
|
+
var XR_HOVER_SHELL_FLAG = "__xrHoverShell";
|
|
10460
|
+
var SHELL_INFLATE = 1.04;
|
|
10461
|
+
var SCALE_SMOOTH_SECONDS = 0.09;
|
|
10462
|
+
var _XRHoverVisualSystem = class _XRHoverVisualSystem {
|
|
10463
|
+
constructor(interactionSystem) {
|
|
10464
|
+
this.records = /* @__PURE__ */ new Map();
|
|
10465
|
+
this.interactionSystem = interactionSystem;
|
|
10466
|
+
}
|
|
10467
|
+
update(world, deltaTime) {
|
|
10468
|
+
if (!world.isXrPresenting()) {
|
|
10469
|
+
this.clearAll(world);
|
|
10470
|
+
return;
|
|
10471
|
+
}
|
|
10472
|
+
const hovered = this.interactionSystem.getHoveredEntityIds();
|
|
10473
|
+
const held = this.interactionSystem.getHeldEntityIds();
|
|
10474
|
+
for (const entityId of hovered) {
|
|
10475
|
+
if (held.has(entityId)) continue;
|
|
10476
|
+
const interactable = world.getComponent(entityId, XRInteractableComponent);
|
|
10477
|
+
if (!interactable?.enabled) continue;
|
|
10478
|
+
if (interactable.hoverBehavior === "none") continue;
|
|
10479
|
+
this.begin(world, entityId, interactable);
|
|
10480
|
+
}
|
|
10481
|
+
for (const [entityId, record] of this.records) {
|
|
10482
|
+
if (!hovered.has(entityId) || held.has(entityId)) {
|
|
10483
|
+
record.active = false;
|
|
10484
|
+
}
|
|
10485
|
+
}
|
|
10486
|
+
this.animate(world, deltaTime);
|
|
10487
|
+
}
|
|
10488
|
+
begin(world, entityId, interactable) {
|
|
10489
|
+
const existing = this.records.get(entityId);
|
|
10490
|
+
if (existing) {
|
|
10491
|
+
existing.active = true;
|
|
10492
|
+
return;
|
|
10493
|
+
}
|
|
10494
|
+
const transform = world.getComponent(entityId, TransformComponent);
|
|
10495
|
+
if (!transform) return;
|
|
10496
|
+
const wantsColor = interactable.hoverBehavior === "color" || interactable.hoverBehavior === "both";
|
|
10497
|
+
this.records.set(entityId, {
|
|
10498
|
+
shell: wantsColor ? this.addShell(world, entityId, interactable) : null,
|
|
10499
|
+
baseScale: new THREE26__namespace.Vector3(
|
|
10500
|
+
transform.scale.x,
|
|
10501
|
+
transform.scale.y,
|
|
10502
|
+
transform.scale.z
|
|
10503
|
+
),
|
|
10504
|
+
progress: 0,
|
|
10505
|
+
active: true
|
|
10506
|
+
});
|
|
10507
|
+
}
|
|
10508
|
+
/** Build an inflated back-face copy of the object's meshes. */
|
|
10509
|
+
addShell(world, entityId, interactable) {
|
|
10510
|
+
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
10511
|
+
if (!object) return null;
|
|
10512
|
+
const material = new THREE26__namespace.MeshBasicMaterial({
|
|
10513
|
+
color: new THREE26__namespace.Color(interactable.hoverColor),
|
|
10514
|
+
// Back faces only, so the shell shows just outside the silhouette instead
|
|
10515
|
+
// of covering the object.
|
|
10516
|
+
side: THREE26__namespace.BackSide,
|
|
10517
|
+
transparent: true,
|
|
10518
|
+
opacity: 0.85,
|
|
10519
|
+
depthWrite: false
|
|
10520
|
+
});
|
|
10521
|
+
const group = new THREE26__namespace.Group();
|
|
10522
|
+
group.name = "XRHoverShell";
|
|
10523
|
+
group.userData[XR_HOVER_SHELL_FLAG] = true;
|
|
10524
|
+
group.renderOrder = 998;
|
|
10525
|
+
object.traverse((child) => {
|
|
10526
|
+
if (!(child instanceof THREE26__namespace.Mesh) || !child.geometry) return;
|
|
10527
|
+
if (child.userData[XR_HOVER_SHELL_FLAG]) return;
|
|
10528
|
+
const clone = new THREE26__namespace.Mesh(child.geometry, material);
|
|
10529
|
+
child.updateWorldMatrix(true, false);
|
|
10530
|
+
object.updateWorldMatrix(true, false);
|
|
10531
|
+
clone.matrixAutoUpdate = false;
|
|
10532
|
+
clone.matrix.copy(object.matrixWorld).invert().multiply(child.matrixWorld).scale(new THREE26__namespace.Vector3(SHELL_INFLATE, SHELL_INFLATE, SHELL_INFLATE));
|
|
10533
|
+
clone.userData[XR_HOVER_SHELL_FLAG] = true;
|
|
10534
|
+
clone.raycast = () => {
|
|
10535
|
+
};
|
|
10536
|
+
group.add(clone);
|
|
10537
|
+
});
|
|
10538
|
+
if (group.children.length === 0) {
|
|
10539
|
+
material.dispose();
|
|
10540
|
+
return null;
|
|
10541
|
+
}
|
|
10542
|
+
object.add(group);
|
|
10543
|
+
return group;
|
|
10544
|
+
}
|
|
10545
|
+
animate(world, deltaTime) {
|
|
10546
|
+
const step = 1 - Math.exp(-Math.max(0, deltaTime) / SCALE_SMOOTH_SECONDS);
|
|
10547
|
+
for (const [entityId, record] of Array.from(this.records)) {
|
|
10548
|
+
const interactable = world.getComponent(entityId, XRInteractableComponent);
|
|
10549
|
+
const target = record.active ? 1 : 0;
|
|
10550
|
+
record.progress += (target - record.progress) * step;
|
|
10551
|
+
const wantsScale = interactable?.hoverBehavior === "scale" || interactable?.hoverBehavior === "both";
|
|
10552
|
+
if (wantsScale) {
|
|
10553
|
+
const transform = world.getComponent(entityId, TransformComponent);
|
|
10554
|
+
if (transform) {
|
|
10555
|
+
const factor = 1 + (interactable.hoverScale - 1) * Math.min(1, record.progress);
|
|
10556
|
+
transform.scale.x = record.baseScale.x * factor;
|
|
10557
|
+
transform.scale.y = record.baseScale.y * factor;
|
|
10558
|
+
transform.scale.z = record.baseScale.z * factor;
|
|
10559
|
+
}
|
|
10560
|
+
}
|
|
10561
|
+
if (!record.active && record.progress < 0.01) {
|
|
10562
|
+
this.finish(world, entityId, record);
|
|
10563
|
+
}
|
|
10564
|
+
}
|
|
10565
|
+
}
|
|
10566
|
+
/** Remove the effect and restore the authored scale exactly. */
|
|
10567
|
+
finish(world, entityId, record) {
|
|
10568
|
+
const transform = world.getComponent(entityId, TransformComponent);
|
|
10569
|
+
if (transform) {
|
|
10570
|
+
transform.scale.x = record.baseScale.x;
|
|
10571
|
+
transform.scale.y = record.baseScale.y;
|
|
10572
|
+
transform.scale.z = record.baseScale.z;
|
|
10573
|
+
}
|
|
10574
|
+
this.disposeShell(record.shell);
|
|
10575
|
+
this.records.delete(entityId);
|
|
10576
|
+
}
|
|
10577
|
+
disposeShell(shell) {
|
|
10578
|
+
if (!shell) return;
|
|
10579
|
+
shell.parent?.remove(shell);
|
|
10580
|
+
shell.traverse((child) => {
|
|
10581
|
+
if (child instanceof THREE26__namespace.Mesh) {
|
|
10582
|
+
const material = child.material;
|
|
10583
|
+
if (Array.isArray(material)) {
|
|
10584
|
+
for (const entry of material) entry.dispose();
|
|
10585
|
+
} else {
|
|
10586
|
+
material?.dispose();
|
|
10587
|
+
}
|
|
10588
|
+
}
|
|
10589
|
+
});
|
|
10590
|
+
}
|
|
10591
|
+
clearAll(world) {
|
|
10592
|
+
for (const [entityId, record] of Array.from(this.records)) {
|
|
10593
|
+
this.finish(world, entityId, record);
|
|
10594
|
+
}
|
|
10595
|
+
}
|
|
10596
|
+
dispose() {
|
|
10597
|
+
for (const record of this.records.values()) {
|
|
10598
|
+
this.disposeShell(record.shell);
|
|
10599
|
+
}
|
|
10600
|
+
this.records.clear();
|
|
10601
|
+
}
|
|
10602
|
+
};
|
|
10603
|
+
__name(_XRHoverVisualSystem, "XRHoverVisualSystem");
|
|
10604
|
+
var XRHoverVisualSystem = _XRHoverVisualSystem;
|
|
10325
10605
|
|
|
10326
10606
|
exports.AnimationSystem = AnimationSystem;
|
|
10327
10607
|
exports.AudioSystem = AudioSystem;
|
|
@@ -10346,10 +10626,12 @@ exports.VRTeleportAreaSystem = VRTeleportAreaSystem;
|
|
|
10346
10626
|
exports.VideoSystem = VideoSystem;
|
|
10347
10627
|
exports.XRControllerVisualSystem = XRControllerVisualSystem;
|
|
10348
10628
|
exports.XRHandPoseSystem = XRHandPoseSystem;
|
|
10629
|
+
exports.XRHoverVisualSystem = XRHoverVisualSystem;
|
|
10349
10630
|
exports.XRInputSystem = XRInputSystem;
|
|
10350
10631
|
exports.XRInteractionSystem = XRInteractionSystem;
|
|
10351
10632
|
exports.XRLocomotionSystem = XRLocomotionSystem;
|
|
10352
10633
|
exports.XRSessionSystem = XRSessionSystem;
|
|
10353
10634
|
exports.XRTeleportVisualSystem = XRTeleportVisualSystem;
|
|
10635
|
+
exports.XR_HOVER_SHELL_FLAG = XR_HOVER_SHELL_FLAG;
|
|
10354
10636
|
//# sourceMappingURL=index.cjs.map
|
|
10355
10637
|
//# sourceMappingURL=index.cjs.map
|