@relu-interactives/spatial-ecs 0.9.0 → 0.10.0

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 (39) hide show
  1. package/dist/{System-8D-XBDKZ.d.cts → System-BldSHxZV.d.cts} +214 -81
  2. package/dist/{System-DPMAW30g.d.ts → System-CADhPyQs.d.ts} +214 -81
  3. package/dist/{XRHandPose-CWSrsnYN.d.ts → XRHandPose-BNSwd1y9.d.ts} +1 -1
  4. package/dist/{XRHandPose-Dn2yiALk.d.cts → XRHandPose-D3Ab1Dfs.d.cts} +1 -1
  5. package/dist/{chunk-VYIWOXAY.js → chunk-TY3XCHOR.js} +18 -10
  6. package/dist/chunk-TY3XCHOR.js.map +1 -0
  7. package/dist/components/index.d.cts +3 -3
  8. package/dist/components/index.d.ts +3 -3
  9. package/dist/docs/guide/bone-attachments-and-ik.md +1 -1
  10. package/dist/docs/guide/multiplayer.md +65 -0
  11. package/dist/factories/index.d.cts +2 -2
  12. package/dist/factories/index.d.ts +2 -2
  13. package/dist/{index-D5MmJNyj.d.ts → index-6pZO_gV7.d.ts} +1 -1
  14. package/dist/{index-CAZHrh0q.d.cts → index-BXjwEdNq.d.cts} +2 -2
  15. package/dist/{index-DiIjV2lm.d.cts → index-BdghvXKE.d.cts} +1 -1
  16. package/dist/{index-CLtSMf2M.d.ts → index-CVG-hREM.d.ts} +2 -2
  17. package/dist/index.cjs +16 -8
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +8 -30
  20. package/dist/index.d.ts +8 -30
  21. package/dist/index.js +2 -2
  22. package/dist/network/index.cjs +681 -4
  23. package/dist/network/index.cjs.map +1 -1
  24. package/dist/network/index.d.cts +126 -5
  25. package/dist/network/index.d.ts +126 -5
  26. package/dist/network/index.js +680 -5
  27. package/dist/network/index.js.map +1 -1
  28. package/dist/systems/index.cjs +16 -8
  29. package/dist/systems/index.cjs.map +1 -1
  30. package/dist/systems/index.d.cts +2 -2
  31. package/dist/systems/index.d.ts +2 -2
  32. package/dist/systems/index.js +1 -1
  33. package/dist/types.d.cts +1 -1
  34. package/dist/types.d.ts +1 -1
  35. package/dist/webgpu/index.d.ts +2 -2
  36. package/dist/worldSnapshotUtils.d.cts +1 -1
  37. package/dist/worldSnapshotUtils.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-VYIWOXAY.js.map +0 -1
@@ -127,6 +127,106 @@ declare class SlotChooser {
127
127
  choose(id: string, slot: SoundSlot, now: number): SoundTake | null;
128
128
  }
129
129
 
130
+ /**
131
+ * The volume groups every sound plays through: each sound's output goes to its
132
+ * bus instead of straight to the listener, so a game can turn music down
133
+ * without touching a single sound, and music dips while a voice plays.
134
+ */
135
+ declare class AudioMixer {
136
+ readonly listener: THREE.AudioListener;
137
+ private readonly buses;
138
+ private readonly volumes;
139
+ private readonly routed;
140
+ constructor(listener: THREE.AudioListener);
141
+ /** The node a sound connects to for this bus. */
142
+ input(bus: AudioBus): GainNode;
143
+ /** Send a three.js sound through a bus. Does nothing when it's already there. */
144
+ route(sound: THREE.Audio<GainNode> | THREE.PositionalAudio, bus: AudioBus): void;
145
+ setVolume(bus: AudioBus, volume: number): void;
146
+ getVolume(bus: AudioBus): number;
147
+ /** Dip the music for `seconds`, then bring it back. A later duck replaces this one. */
148
+ duckMusic(seconds: number): void;
149
+ dispose(): void;
150
+ }
151
+
152
+ /** Options for {@link AudioSystem.playSlot}. */
153
+ type PlaySlotOptions = {
154
+ /** Multiplies the slot's volume. */
155
+ volume?: number;
156
+ /** Play from this point in the world instead of everywhere. */
157
+ position?: {
158
+ x: number;
159
+ y: number;
160
+ z: number;
161
+ };
162
+ };
163
+ /**
164
+ * Reconciles `AudioComponent` state with the underlying THREE.js audio objects
165
+ * each frame.
166
+ *
167
+ * **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
168
+ * audio node based on the `isPlaying` / `isPaused` flags set by
169
+ * `AudioComponent.play()`, `.pause()`, and `.stop()`.
170
+ *
171
+ * **Option sync** — detects changes to `loop`, `pitch`, `volume`,
172
+ * `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
173
+ * Changes take effect on the next frame, so scripts and inspector edits during
174
+ * runtime are reflected without reloading the scene.
175
+ *
176
+ * **Mixing** — every sound plays through a bus (`sfx`, `voice`, `music`) with
177
+ * its own volume, and music dips while a voice plays.
178
+ *
179
+ * **Sound banks** — {@link loadSoundBank} and {@link playSlot} play named
180
+ * sounds from a `.soundbank.json` asset, as a random take.
181
+ *
182
+ * Only active in **preview** mode (`isEditor: true` makes every update a
183
+ * no-op so the editor is unaffected).
184
+ *
185
+ * @category Systems
186
+ */
187
+ declare class AudioSystem implements EcsSystem {
188
+ private readonly isEditor;
189
+ /** THREE.js `isPlaying` state captured at the end of the previous frame. */
190
+ private readonly prevPlayingState;
191
+ /** Snapshot of options applied in the previous frame, for change detection. */
192
+ private readonly prevOptions;
193
+ /** Tracks entities that were stopped due to invisibility. */
194
+ private readonly stoppedDueToInvisibility;
195
+ private world;
196
+ private mixer;
197
+ private readonly slots;
198
+ private readonly buffers;
199
+ private readonly chooser;
200
+ private voice;
201
+ constructor({ isEditor }?: {
202
+ isEditor?: boolean;
203
+ });
204
+ /** Scripts can load a bank in `init`, before this system's first update. */
205
+ attachWorld(world: World): void;
206
+ /** The mixer, made with the listener on first use. */
207
+ getMixer(): AudioMixer | null;
208
+ /** Set a bus's volume (`0` silent, `1` as mixed). */
209
+ setBusVolume(bus: AudioBus, volume: number): void;
210
+ getBusVolume(bus: AudioBus): number;
211
+ /**
212
+ * Fetch a `.soundbank.json` and decode its recordings. Its slots add to any
213
+ * loaded before, and a slot id used twice takes the later one.
214
+ * @param source an asset path, or a script's `AssetInput` field
215
+ */
216
+ loadSoundBank(source: string | {
217
+ path: string;
218
+ }): Promise<void>;
219
+ /**
220
+ * Play a named sound from a loaded bank. Returns whether it sounded: a slot's
221
+ * chance, cooldown and priority can each keep it quiet, and that's normal.
222
+ */
223
+ playSlot(id: string, options?: PlaySlotOptions): boolean;
224
+ update(world: World, _deltaTime: number): void;
225
+ /** Apply any changed options from the component to the THREE.js audio node. */
226
+ private _syncOptions;
227
+ dispose(_world: World): void;
228
+ }
229
+
130
230
  /** Skybox rendering modes. `none` disables skybox rendering entirely. */
131
231
  type EnvironmentSkyboxType = "gradient" | "color" | "image" | "none";
132
232
  /** Gradient distribution applied when {@link EnvironmentSkyboxState.type} is `"gradient"`. */
@@ -687,6 +787,67 @@ type NetEntityView = {
687
787
  props: Record<string, string>;
688
788
  };
689
789
  type NetPose = Pick<NetEntityView, "x" | "y" | "z" | "qx" | "qy" | "qz" | "qw">;
790
+ /** A sound-bank slot one player plays for everyone. */
791
+ type NetSound = {
792
+ id: string;
793
+ volume?: number;
794
+ x?: number;
795
+ y?: number;
796
+ z?: number;
797
+ };
798
+ /** What sets up a direct voice connection between two players. */
799
+ type VoiceSignal = {
800
+ kind: "offer" | "answer";
801
+ sdp: string;
802
+ } | {
803
+ kind: "ice";
804
+ candidate: RTCIceCandidateInit;
805
+ };
806
+ type VoiceToRoom = {
807
+ t: "hello";
808
+ } | {
809
+ t: "join";
810
+ } | {
811
+ t: "leave";
812
+ } | {
813
+ t: "mic";
814
+ on: boolean;
815
+ } | {
816
+ t: "signal";
817
+ to: string;
818
+ signal: VoiceSignal;
819
+ };
820
+ type VoiceFromRoom = {
821
+ t: "caps";
822
+ available: boolean;
823
+ maxPeers: number;
824
+ } | {
825
+ t: "welcome";
826
+ peers: {
827
+ id: string;
828
+ mic: boolean;
829
+ }[];
830
+ iceServers: RTCIceServer[];
831
+ /** Send through the relay only, so players never see each other's addresses. */
832
+ relayOnly: boolean;
833
+ } | {
834
+ t: "refused";
835
+ reason: "off" | "full";
836
+ } | {
837
+ t: "joined";
838
+ id: string;
839
+ } | {
840
+ t: "left";
841
+ id: string;
842
+ } | {
843
+ t: "mic";
844
+ id: string;
845
+ on: boolean;
846
+ } | {
847
+ t: "signal";
848
+ from: string;
849
+ signal: VoiceSignal;
850
+ };
690
851
  /** What a shared-world connection must do. `ColyseusTransport` is the real one. */
691
852
  interface NetworkTransport {
692
853
  readonly sessionId: string;
@@ -702,6 +863,9 @@ interface NetworkTransport {
702
863
  onMessage(cb: (name: string, payload: unknown, from: string) => void): void;
703
864
  /** The server overruled the owner's pose. */
704
865
  onCorrect(cb: (id: string, pose: NetPose) => void): void;
866
+ /** Another player played a sound for everyone. */
867
+ onSound(cb: (sound: NetSound, from: string) => void): void;
868
+ onVoice(cb: (message: VoiceFromRoom) => void): void;
705
869
  onClose(cb: () => void): void;
706
870
  /** Tell the room about the scene's shared objects; the first client's copy wins. */
707
871
  registerScene(entities: (NetPose & {
@@ -716,6 +880,8 @@ interface NetworkTransport {
716
880
  sendPose(id: string, pose: NetPose): void;
717
881
  setProp(id: string, key: string, json: string): void;
718
882
  send(name: string, payload: unknown): void;
883
+ sendSound(sound: NetSound): void;
884
+ sendVoice(message: VoiceToRoom): void;
719
885
  leave(): void;
720
886
  }
721
887
  /** Options for {@link NetworkHandle.spawn}. */
@@ -733,6 +899,42 @@ type NetSpawnOptions = {
733
899
  };
734
900
  props?: Record<string, NetValue>;
735
901
  };
902
+ /** Someone else in voice chat. */
903
+ interface VoicePeer {
904
+ readonly id: string;
905
+ /** The direct connection is up. */
906
+ readonly connected: boolean;
907
+ readonly talking: boolean;
908
+ /** They haven't muted their own mic. */
909
+ readonly micOn: boolean;
910
+ /** This player muted them. */
911
+ readonly muted: boolean;
912
+ readonly volume: number;
913
+ }
914
+ /** Voice chat: `this.network.voice`, `null` when the project doesn't have it on. */
915
+ interface VoiceHandle {
916
+ /** The room offers voice and this page can use a mic. */
917
+ readonly available: boolean;
918
+ readonly state: "off" | "connecting" | "on";
919
+ readonly micMuted: boolean;
920
+ /** This player is talking right now. */
921
+ readonly talking: boolean;
922
+ /** Why the last attempt failed, in words for the player. */
923
+ readonly error: string;
924
+ readonly peers: VoicePeer[];
925
+ /** Hear each voice from its character, when there is one. On by default. */
926
+ positional: boolean;
927
+ /** Turn voice on. Call from a tap or key: that's what lets the browser ask for the mic. */
928
+ enable(): Promise<boolean>;
929
+ disable(): void;
930
+ setMicMuted(muted: boolean): Promise<void>;
931
+ /** Stop hearing someone. They aren't told. */
932
+ setPeerMuted(id: string, muted: boolean): void;
933
+ /** 0 to 2. */
934
+ setPeerVolume(id: string, volume: number): void;
935
+ /** Something above changed. Returns the way to stop listening. */
936
+ onChange(listener: () => void): () => void;
937
+ }
736
938
  /** A Behaviour's view of the shared world: `this.network`, `null` in a single-player run. */
737
939
  interface NetworkHandle {
738
940
  readonly connected: boolean;
@@ -744,10 +946,17 @@ interface NetworkHandle {
744
946
  readonly isOwner: boolean;
745
947
  /** Everyone in the room, by session id. */
746
948
  readonly players: string[];
949
+ /** Voice chat, when the project has it on. */
950
+ readonly voice: VoiceHandle | null;
747
951
  /** Send to the room. Others hear it in `onMessage`, unless a server hook keeps it. */
748
952
  send(name: string, payload?: unknown): void;
749
953
  /** Listen for a message. Returns the way to stop. */
750
954
  onMessage(name: string, handler: (payload: unknown, from: string) => void): () => void;
955
+ /**
956
+ * Play a sound-bank slot here and for everyone in the room. Returns whether it
957
+ * sounded: a slot's chance and cooldown can keep it quiet, and then no one hears it.
958
+ */
959
+ playSlot(id: string, options?: PlaySlotOptions): boolean;
751
960
  /** Spawn a prefab everyone sees, owned by this client. */
752
961
  spawn(prefab: string | {
753
962
  path: string;
@@ -1402,84 +1611,6 @@ declare class TransformSyncSystem implements EcsSystem {
1402
1611
  update(world: World): void;
1403
1612
  }
1404
1613
 
1405
- /** Options for {@link AudioSystem.playSlot}. */
1406
- type PlaySlotOptions = {
1407
- /** Multiplies the slot's volume. */
1408
- volume?: number;
1409
- /** Play from this point in the world instead of everywhere. */
1410
- position?: {
1411
- x: number;
1412
- y: number;
1413
- z: number;
1414
- };
1415
- };
1416
- /**
1417
- * Reconciles `AudioComponent` state with the underlying THREE.js audio objects
1418
- * each frame.
1419
- *
1420
- * **Playback** — drives `play()`, `pause()`, and `stop()` on the THREE.js
1421
- * audio node based on the `isPlaying` / `isPaused` flags set by
1422
- * `AudioComponent.play()`, `.pause()`, and `.stop()`.
1423
- *
1424
- * **Option sync** — detects changes to `loop`, `pitch`, `volume`,
1425
- * `refDistance`, `distanceModel`, and `rolloffFactor` and applies them live.
1426
- * Changes take effect on the next frame, so scripts and inspector edits during
1427
- * runtime are reflected without reloading the scene.
1428
- *
1429
- * **Mixing** — every sound plays through a bus (`sfx`, `voice`, `music`) with
1430
- * its own volume, and music dips while a voice plays.
1431
- *
1432
- * **Sound banks** — {@link loadSoundBank} and {@link playSlot} play named
1433
- * sounds from a `.soundbank.json` asset, as a random take.
1434
- *
1435
- * Only active in **preview** mode (`isEditor: true` makes every update a
1436
- * no-op so the editor is unaffected).
1437
- *
1438
- * @category Systems
1439
- */
1440
- declare class AudioSystem implements EcsSystem {
1441
- private readonly isEditor;
1442
- /** THREE.js `isPlaying` state captured at the end of the previous frame. */
1443
- private readonly prevPlayingState;
1444
- /** Snapshot of options applied in the previous frame, for change detection. */
1445
- private readonly prevOptions;
1446
- /** Tracks entities that were stopped due to invisibility. */
1447
- private readonly stoppedDueToInvisibility;
1448
- private world;
1449
- private mixer;
1450
- private readonly slots;
1451
- private readonly buffers;
1452
- private readonly chooser;
1453
- private voice;
1454
- constructor({ isEditor }?: {
1455
- isEditor?: boolean;
1456
- });
1457
- /** Scripts can load a bank in `init`, before this system's first update. */
1458
- attachWorld(world: World): void;
1459
- /** The mixer, made with the listener on first use. */
1460
- private getMixer;
1461
- /** Set a bus's volume (`0` silent, `1` as mixed). */
1462
- setBusVolume(bus: AudioBus, volume: number): void;
1463
- getBusVolume(bus: AudioBus): number;
1464
- /**
1465
- * Fetch a `.soundbank.json` and decode its recordings. Its slots add to any
1466
- * loaded before, and a slot id used twice takes the later one.
1467
- * @param source an asset path, or a script's `AssetInput` field
1468
- */
1469
- loadSoundBank(source: string | {
1470
- path: string;
1471
- }): Promise<void>;
1472
- /**
1473
- * Play a named sound from a loaded bank. Returns whether it sounded: a slot's
1474
- * chance, cooldown and priority can each keep it quiet, and that's normal.
1475
- */
1476
- playSlot(id: string, options?: PlaySlotOptions): boolean;
1477
- update(world: World, _deltaTime: number): void;
1478
- /** Apply any changed options from the component to the THREE.js audio node. */
1479
- private _syncOptions;
1480
- dispose(_world: World): void;
1481
- }
1482
-
1483
1614
  /**
1484
1615
  * Runs each {@link IKComponent}'s chains after the animation: hands and feet
1485
1616
  * reach their target entities. Bones the animation doesn't drive would keep
@@ -1490,8 +1621,10 @@ declare class AudioSystem implements EcsSystem {
1490
1621
  */
1491
1622
  declare class IKSystem implements EcsSystem {
1492
1623
  private readonly runtimes;
1493
- private readonly reach;
1494
- /** How far a limb's end stayed from its target last frame, in metres (0 = reached). */
1624
+ /**
1625
+ * How far a limb's end stayed from its target last frame, in metres
1626
+ * (0 = reached), or null if the limb's chain didn't run.
1627
+ */
1495
1628
  getReachError(entityId: EntityId, limb: IKLimb): number | null;
1496
1629
  private restore;
1497
1630
  update(world: World): void;
@@ -1880,4 +2013,4 @@ interface EcsSystem {
1880
2013
  dispose?(world: World): void;
1881
2014
  }
1882
2015
 
1883
- export { type EcsEntityKind as $, type TransformData as A, normalizeEnvironmentLighting as B, type ChromaKeyOptions as C, DEFAULT_ENVIRONMENT_LIGHTING as D, type EcsRenderer as E, normalizeIKChain as F, type NetworkTransport as G, type NetEntityView as H, type IKChain as I, type NetPose as J, type EcsSystem as K, type NetworkService as L, type EntityId as M, type NetValue as N, type NetworkHandle as O, type PostprocessingPipeline as P, type NetSpawnOptions as Q, type RenderBackend as R, type WorldEntityView$1 as S, TransformComponent as T, type SpawnPrefabSource as U, type Vec3$1 as V, World as W, type SpawnPrefabOptions as X, type PlaySlotOptions as Y, type ComponentClass as Z, type ParentLookup as _, type PostprocessingBuildContext as a, ObjectManagementSystem as a0, type SubtreeSnapshot as a1, type ExternalRefWarning as a2, type AudioBus as a3, type AssetInput as a4, AudioSystem as a5, type CheckboxInput as a6, type ColorInput as a7, type ComponentFactory as a8, type ComponentInput as a9, SlotChooser as aA, type SoundBankAsset as aB, type SoundSlot as aC, type SoundTake as aD, type TextInput as aE, type ToggleInput as aF, TransformSyncSystem as aG, type Vec3 as aH, type Vector2Input as aI, type Vector3Input as aJ, clearPrefabCache as aK, despawnPrefab as aL, findModelBone as aM, listModelBones as aN, loadPrefab as aO, parsePrefabAsset as aP, prefabFileVersionFor as aQ, remapSnapshotEntityIds as aR, setPrefabAssetUrlResolver as aS, soundBankFiles as aT, spawnPrefab as aU, type AnyComponent as aV, DEBUG_CHANGE_IGNORED_SYSTEMS as aW, type WorldHistorySnapshot as aX, cloneHistoryValue as aY, normalizeDebugValue as aZ, type ComponentKind as aa, type DropdownInput as ab, type DropdownOption as ac, type EcsComponentFactoryKind as ad, type EcsEntityEditorKind as ae, type EntityInput as af, type FloatInput as ag, IKSystem as ah, InputSystem as ai, type IntersectionResult as aj, type KeyboardKey as ak, KeyboardKeys as al, type ModelBoneInfo as am, type MouseButton as an, PREFAB_FILE_VERSION as ao, PREFAB_FILE_VERSION_NESTED as ap, type PrefabAsset as aq, type RemapSnapshotOptions as ar, RenderSystem as as, type ScriptErrorEvent as at, type ScriptErrorListener as au, type ScriptErrorPhase as av, type ScriptErrorReport as aw, type ScriptErrorSource as ax, type SelectionListener as ay, type SliderInput as az, type PostprocessingState as b, type RendererKind as c, Component as d, DEFAULT_ENVIRONMENT_STATE as e, DEFAULT_POSTPROCESSING_STATE as f, Environment as g, type EnvironmentFogState as h, type EnvironmentFogType as i, type EnvironmentGradientEffect as j, type EnvironmentLightingState as k, type EnvironmentSkyboxImageProjection as l, type EnvironmentSkyboxState as m, type EnvironmentSkyboxType as n, type EnvironmentState as o, type EnvironmentToneMapping as p, IKComponent as q, type IKLimb as r, type IKOptions as s, NetworkIdentityComponent as t, NetworkSpawnerComponent as u, NetworkTransformComponent as v, type NetworkTransformOptions as w, NetworkedPropsComponent as x, ParentId as y, Postprocessing as z };
2016
+ export { type WorldEntityView$1 as $, type TransformData as A, normalizeEnvironmentLighting as B, type ChromaKeyOptions as C, DEFAULT_ENVIRONMENT_LIGHTING as D, type EcsRenderer as E, normalizeIKChain as F, type NetworkTransport as G, type NetEntityView as H, type IKChain as I, type NetPose as J, type NetSound as K, type VoiceFromRoom as L, type VoiceToRoom as M, type NetValue as N, type VoiceHandle as O, type PostprocessingPipeline as P, type VoicePeer as Q, type RenderBackend as R, type EcsSystem as S, TransformComponent as T, type NetworkService as U, type Vec3$1 as V, World as W, type EntityId as X, type NetworkHandle as Y, type NetSpawnOptions as Z, type VoiceSignal as _, type PostprocessingBuildContext as a, spawnPrefab as a$, type SpawnPrefabSource as a0, type SpawnPrefabOptions as a1, type PlaySlotOptions as a2, type ComponentClass as a3, type ParentLookup as a4, type EcsEntityKind as a5, ObjectManagementSystem as a6, type SubtreeSnapshot as a7, type ExternalRefWarning as a8, type AssetInput as a9, type ScriptErrorEvent as aA, type ScriptErrorListener as aB, type ScriptErrorPhase as aC, type ScriptErrorReport as aD, type ScriptErrorSource as aE, type SelectionListener as aF, type SliderInput as aG, SlotChooser as aH, type SoundBankAsset as aI, type SoundSlot as aJ, type SoundTake as aK, type TextInput as aL, type ToggleInput as aM, TransformSyncSystem as aN, type Vec3 as aO, type Vector2Input as aP, type Vector3Input as aQ, clearPrefabCache as aR, despawnPrefab as aS, findModelBone as aT, listModelBones as aU, loadPrefab as aV, parsePrefabAsset as aW, prefabFileVersionFor as aX, remapSnapshotEntityIds as aY, setPrefabAssetUrlResolver as aZ, soundBankFiles as a_, type AudioBus as aa, AudioMixer as ab, AudioSystem as ac, type CheckboxInput as ad, type ColorInput as ae, type ComponentFactory as af, type ComponentInput as ag, type ComponentKind as ah, type DropdownInput as ai, type DropdownOption as aj, type EcsComponentFactoryKind as ak, type EcsEntityEditorKind as al, type EntityInput as am, type FloatInput as an, IKSystem as ao, InputSystem as ap, type IntersectionResult as aq, type KeyboardKey as ar, KeyboardKeys as as, type ModelBoneInfo as at, type MouseButton as au, PREFAB_FILE_VERSION as av, PREFAB_FILE_VERSION_NESTED as aw, type PrefabAsset as ax, type RemapSnapshotOptions as ay, RenderSystem as az, type PostprocessingState as b, type AnyComponent as b0, DEBUG_CHANGE_IGNORED_SYSTEMS as b1, type WorldHistorySnapshot as b2, cloneHistoryValue as b3, normalizeDebugValue as b4, type RendererKind as c, Component as d, DEFAULT_ENVIRONMENT_STATE as e, DEFAULT_POSTPROCESSING_STATE as f, Environment as g, type EnvironmentFogState as h, type EnvironmentFogType as i, type EnvironmentGradientEffect as j, type EnvironmentLightingState as k, type EnvironmentSkyboxImageProjection as l, type EnvironmentSkyboxState as m, type EnvironmentSkyboxType as n, type EnvironmentState as o, type EnvironmentToneMapping as p, IKComponent as q, type IKLimb as r, type IKOptions as s, NetworkIdentityComponent as t, NetworkSpawnerComponent as u, NetworkTransformComponent as v, type NetworkTransformOptions as w, NetworkedPropsComponent as x, ParentId as y, Postprocessing as z };
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { d as Component, a3 as AudioBus, $ as EcsEntityKind, ae as EcsEntityEditorKind, M as EntityId } from './System-DPMAW30g.js';
2
+ import { d as Component, aa as AudioBus, a5 as EcsEntityKind, al as EcsEntityEditorKind, X as EntityId } from './System-CADhPyQs.js';
3
3
  import * as RAPIER from '@dimforge/rapier3d-compat';
4
4
  import { a as XrFinger, c as XrHandPoseDirection, b as XrHandPoseOrientation, X as XrHandPoseDefinition } from './handPose-DlcTtqgx.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as THREE from 'three';
2
- import { C as Component, _ as AudioBus, U as EcsEntityKind, aa as EcsEntityEditorKind, G as EntityId } from './System-8D-XBDKZ.cjs';
2
+ import { C as Component, a5 as AudioBus, a0 as EcsEntityKind, ah as EcsEntityEditorKind, M as EntityId } from './System-BldSHxZV.cjs';
3
3
  import * as RAPIER from '@dimforge/rapier3d-compat';
4
4
  import { a as XrFinger, c as XrHandPoseDirection, b as XrHandPoseOrientation, X as XrHandPoseDefinition } from './handPose-DlcTtqgx.cjs';
5
5
 
@@ -7280,9 +7280,14 @@ function uiImage(src) {
7280
7280
  const blob = await response.blob();
7281
7281
  const typed = /\.svg(\?|#|$)/i.test(url) ? new Blob([blob], { type: "image/svg+xml" }) : blob;
7282
7282
  const image = new Image();
7283
- image.src = URL.createObjectURL(typed);
7284
- await image.decode();
7285
- return image;
7283
+ const objectUrl = URL.createObjectURL(typed);
7284
+ try {
7285
+ image.src = objectUrl;
7286
+ await image.decode();
7287
+ return image;
7288
+ } finally {
7289
+ URL.revokeObjectURL(objectUrl);
7290
+ }
7286
7291
  })()
7287
7292
  ).then((image) => {
7288
7293
  entry.value = image;
@@ -8915,11 +8920,13 @@ var _pq = new THREE26.Quaternion();
8915
8920
  var _IKSystem = class _IKSystem {
8916
8921
  constructor() {
8917
8922
  this.runtimes = /* @__PURE__ */ new Map();
8918
- this.reach = /* @__PURE__ */ new Map();
8919
8923
  }
8920
- /** How far a limb's end stayed from its target last frame, in metres (0 = reached). */
8924
+ /**
8925
+ * How far a limb's end stayed from its target last frame, in metres
8926
+ * (0 = reached), or null if the limb's chain didn't run.
8927
+ */
8921
8928
  getReachError(entityId, limb) {
8922
- return this.reach.get(`${entityId}:${limb}`) ?? null;
8929
+ return this.runtimes.get(entityId)?.reach.get(limb) ?? null;
8923
8930
  }
8924
8931
  restore(runtime) {
8925
8932
  for (const [bone, w] of runtime.written) {
@@ -8945,13 +8952,14 @@ var _IKSystem = class _IKSystem {
8945
8952
  let runtime = this.runtimes.get(id);
8946
8953
  if (!runtime || runtime.rootUuid !== root.uuid) {
8947
8954
  if (runtime) this.restore(runtime);
8948
- runtime = { rootUuid: root.uuid, limbs: /* @__PURE__ */ new Map(), written: /* @__PURE__ */ new Map() };
8955
+ runtime = { rootUuid: root.uuid, limbs: /* @__PURE__ */ new Map(), written: /* @__PURE__ */ new Map(), reach: /* @__PURE__ */ new Map() };
8949
8956
  this.runtimes.set(id, runtime);
8950
8957
  }
8951
8958
  for (const [bone, w] of runtime.written) {
8952
8959
  if (bone.quaternion.equals(w.written)) bone.quaternion.copy(w.before);
8953
8960
  }
8954
8961
  runtime.written.clear();
8962
+ runtime.reach.clear();
8955
8963
  if (!ik.enabled) continue;
8956
8964
  const active = ik.chains.filter((c) => c.enabled && c.weight > 0 && typeof c.target === "number");
8957
8965
  if (active.length === 0) continue;
@@ -8981,7 +8989,7 @@ var _IKSystem = class _IKSystem {
8981
8989
  if (poleObject) poleObject.getWorldPosition(_p2);
8982
8990
  else lower.getWorldPosition(_p2);
8983
8991
  const miss = twoBoneIK(upper, lower, end, _t, _p2);
8984
- this.reach.set(`${id}:${chain.limb}`, Math.max(0, miss));
8992
+ runtime.reach.set(chain.limb, Math.max(0, miss));
8985
8993
  if (chain.matchRotation) {
8986
8994
  target.getWorldQuaternion(_q3);
8987
8995
  end.parent?.getWorldQuaternion(_pq);
@@ -10249,5 +10257,5 @@ __name(_XRHoverVisualSystem, "XRHoverVisualSystem");
10249
10257
  var XRHoverVisualSystem = _XRHoverVisualSystem;
10250
10258
 
10251
10259
  export { ARC_GRAVITY, ARC_MAX_TIME, ARC_SPEED, ARC_STEPS, AnimationSystem, AudioMixer, AudioSystem, CURLED_COS, CameraSyncSystem, DEFAULT_DIRECTION_TOLERANCE, DEFAULT_ENTER_CONFIDENCE, DEFAULT_EXIT_CONFIDENCE, DEFAULT_LOST_GRACE_SECONDS, DEFAULT_MIN_HOLD_SECONDS, DEFAULT_SCRIPT_ERROR_RETRY_DELAY, EnvironmentSyncSystem, FALLBACK_HAND_SCALE, HandPoseTracker, IKSystem, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MATCH_FALLOFF, MAX_PLAUSIBLE_SPEED, MAX_SAMPLE_AGE_SECONDS, MaterialSyncSystem, MeshGeometrySystem, NO_XR_CAPABILITIES, ObjectVisibilitySystem, PINCH_FINGERS, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, STRAIGHT_COS, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, SlotChooser, TeleportAimGate, ThrowVelocityTracker, TransformSyncSystem, UIInteractionSystem, UIPanelSystem, VELOCITY_SAMPLES, VRTeleportAreaSystem, VideoSystem, XRAnchorSystem, XRControllerVisualSystem, XREnvironmentSystem, XRHandPoseSystem, XRHitTestSystem, XRHoverVisualSystem, XRInputSystem, XRInteractionSystem, XRLocomotionSystem, XRSessionSystem, XRTeleportVisualSystem, XR_FINGERS, XR_HOVER_SHELL_FLAG, angularVelocityFrom, applyHandMaterial, arcGroundCrossing, computeFingerCurl, computeHandShape, computePalmPose, computePalmWidth, computePinch, computeSpread, createHandMaterial, estimateHandScale, gripQuaternion, matchHandPose, readXrCapabilities, sampleTeleportArc, setWorldQuaternion, soundBankFiles, twoBoneIK };
10252
- //# sourceMappingURL=chunk-VYIWOXAY.js.map
10253
- //# sourceMappingURL=chunk-VYIWOXAY.js.map
10260
+ //# sourceMappingURL=chunk-TY3XCHOR.js.map
10261
+ //# sourceMappingURL=chunk-TY3XCHOR.js.map