@relu-interactives/spatial-ecs 0.3.19 → 0.3.21

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.
Files changed (49) hide show
  1. package/dist/{chunk-JYKFLQB5.js → chunk-CDSE7476.js} +38 -3
  2. package/dist/chunk-CDSE7476.js.map +1 -0
  3. package/dist/docs/guide/accessing-components.md +7 -6
  4. package/dist/docs/guide/behaviour-data-binding/component-input.md +10 -6
  5. package/dist/docs/guide/behaviour-data-binding/entity-input.md +13 -5
  6. package/dist/docs/guide/camera-rigs.md +2 -2
  7. package/dist/docs/guide/components/animation.md +12 -5
  8. package/dist/docs/guide/components/audio.md +13 -6
  9. package/dist/docs/guide/components/camera.md +10 -4
  10. package/dist/docs/guide/components/entity-type.md +13 -6
  11. package/dist/docs/guide/components/image-target-anchor.md +6 -2
  12. package/dist/docs/guide/components/image-target.md +10 -5
  13. package/dist/docs/guide/components/image.md +10 -4
  14. package/dist/docs/guide/components/instance-slot.md +7 -3
  15. package/dist/docs/guide/components/instanced-mesh.md +15 -7
  16. package/dist/docs/guide/components/light.md +10 -4
  17. package/dist/docs/guide/components/material.md +14 -8
  18. package/dist/docs/guide/components/mesh-geometry.md +10 -4
  19. package/dist/docs/guide/components/mesh.md +10 -4
  20. package/dist/docs/guide/components/model.md +4 -2
  21. package/dist/docs/guide/components/name.md +11 -6
  22. package/dist/docs/guide/components/object3d-ref.md +7 -3
  23. package/dist/docs/guide/components/parent-id.md +10 -4
  24. package/dist/docs/guide/components/physics.md +12 -6
  25. package/dist/docs/guide/components/script.md +10 -4
  26. package/dist/docs/guide/components/sprite.md +10 -4
  27. package/dist/docs/guide/components/transform.md +6 -2
  28. package/dist/docs/guide/components/video.md +10 -4
  29. package/dist/docs/guide/prefabs.md +2 -0
  30. package/dist/docs/guide/runtime-entity-management.md +1 -1
  31. package/dist/docs/guide/spawning/instanced-mesh.md +11 -6
  32. package/dist/docs/guide/systems/input-system.md +4 -1
  33. package/dist/docs/guide/systems/script-object-system.md +9 -1
  34. package/dist/docs/guide/vr-and-hand-poses.md +105 -1
  35. package/dist/docs/guide/world-api.md +23 -15
  36. package/dist/{index-C_589fc4.d.ts → index-6l4hn2Sh.d.ts} +14 -0
  37. package/dist/{index-3pNbH0iP.d.cts → index-C2I5PxCI.d.cts} +14 -0
  38. package/dist/index.cjs +36 -1
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +2 -2
  43. package/dist/systems/index.cjs +36 -1
  44. package/dist/systems/index.cjs.map +1 -1
  45. package/dist/systems/index.d.cts +1 -1
  46. package/dist/systems/index.d.ts +1 -1
  47. package/dist/systems/index.js +1 -1
  48. package/package.json +4 -2
  49. package/dist/chunk-JYKFLQB5.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, ao as XrHandPreset } from './XRHandPose-CLl4MiHx.cjs';
5
5
  export { aA as AnimationStateCallbacks, aB as AnimationStateMachine, aC as AnimationStateManager, aD as StateMachine } from './XRHandPose-CLl4MiHx.cjs';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-3pNbH0iP.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-3pNbH0iP.cjs';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-C2I5PxCI.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-C2I5PxCI.cjs';
8
8
  export { i as CoreComponents } from './index-g777AmFv.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';
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ export { A as AssetInput, t as CheckboxInput, u as ColorInput, v as ComponentFac
3
3
  import * as THREE from 'three';
4
4
  import { O as Object3DRef, ao as XrHandPreset } from './XRHandPose-CrzI57JA.js';
5
5
  export { aA as AnimationStateCallbacks, aB as AnimationStateMachine, aC as AnimationStateManager, aD as StateMachine } from './XRHandPose-CrzI57JA.js';
6
- import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-C_589fc4.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-C_589fc4.js';
6
+ import { X as XrCapabilities, a as XrInputState, b as XrHandPoseEventDetail } from './index-6l4hn2Sh.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-6l4hn2Sh.js';
8
8
  export { i as CoreComponents } from './index-JRcoel9F.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';
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-JYKFLQB5.js';
2
- 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 } from './chunk-JYKFLQB5.js';
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-CDSE7476.js';
2
+ 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 } from './chunk-CDSE7476.js';
3
3
  import { registerDefaultFactories } from './chunk-P42OE3RU.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-P42OE3RU.js';
5
5
  import { ObjectManagementSystem } from './chunk-D6KXWNYT.js';
@@ -8332,6 +8332,25 @@ var _XRInputSystem = class _XRInputSystem {
8332
8332
  }
8333
8333
  return null;
8334
8334
  }
8335
+ /**
8336
+ * The ARTICULATED source for a hand — the one carrying joint poses.
8337
+ *
8338
+ * Distinct from {@link getInput} because a hand can be backed by several
8339
+ * sources at once: a Quest reports a controller AND a tracked hand for the
8340
+ * same handedness, and Vision Pro adds a transient pinch alongside its two
8341
+ * persistent hands. `getInput` returns whichever was seen first, so anything
8342
+ * needing JOINTS has to ask for them specifically — taking the first match
8343
+ * silently handed pose detection a controller with no joints, and no pose
8344
+ * ever fired.
8345
+ */
8346
+ getHandInput(handedness) {
8347
+ for (const record of this.records.values()) {
8348
+ const state = record.state;
8349
+ if (state.handedness !== handedness) continue;
8350
+ if (state.joints) return state;
8351
+ }
8352
+ return null;
8353
+ }
8335
8354
  /** True while ANY source is selecting — the portable "is the user acting" check. */
8336
8355
  isSelecting() {
8337
8356
  for (const record of this.records.values()) {
@@ -10583,6 +10602,8 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10583
10602
  /** Reused so head-relative orientation checks allocate nothing per frame. */
10584
10603
  this.headPosition = new THREE26__namespace.Vector3();
10585
10604
  this.elapsed = 0;
10605
+ this.warnedNoHands = false;
10606
+ this.noHandSeconds = 0;
10586
10607
  this.inputSystem = inputSystem;
10587
10608
  }
10588
10609
  update(world, deltaTime) {
@@ -10594,6 +10615,20 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10594
10615
  this.refreshShapes();
10595
10616
  const entries = this.collectEntries(world);
10596
10617
  if (entries.length === 0) return;
10618
+ if (!this.warnedNoHands) {
10619
+ const tracked = this.shapes.get("left") !== null || this.shapes.get("right") !== null;
10620
+ if (tracked) {
10621
+ this.warnedNoHands = true;
10622
+ } else {
10623
+ this.noHandSeconds += deltaTime;
10624
+ if (this.noHandSeconds > 5) {
10625
+ this.warnedNoHands = true;
10626
+ console.warn(
10627
+ "[XRHandPoseSystem] Hand poses are configured but no tracked hands have been seen. Hand poses need HAND TRACKING \u2014 put the controllers down and enable hand tracking on the headset."
10628
+ );
10629
+ }
10630
+ }
10631
+ }
10597
10632
  world.getCamera().getWorldPosition(this.headPosition);
10598
10633
  const context = { headPosition: this.headPosition };
10599
10634
  for (const { entityId, entry } of entries) {
@@ -10638,7 +10673,7 @@ var _XRHandPoseSystem = class _XRHandPoseSystem {
10638
10673
  /** Derive each hand's shape once for the whole frame. */
10639
10674
  refreshShapes() {
10640
10675
  for (const handedness of ["left", "right"]) {
10641
- const input = this.inputSystem.getInput(handedness);
10676
+ const input = this.inputSystem.getHandInput(handedness);
10642
10677
  const joints = input?.joints ?? null;
10643
10678
  this.shapes.set(
10644
10679
  handedness,