@needle-tools/engine 5.1.0-canary.deec6e4 → 5.1.0-canary.e7c2511

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 (243) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{needle-engine.bundle-CvtELXh0.js → needle-engine.bundle-D-eWNCu1.js} +15969 -15550
  4. package/dist/needle-engine.bundle-D3ZUII8o.min.js +1733 -0
  5. package/dist/needle-engine.bundle-_rOpvUGL.umd.cjs +1733 -0
  6. package/dist/needle-engine.d.ts +746 -156
  7. package/dist/needle-engine.js +529 -529
  8. package/dist/needle-engine.min.js +1 -1
  9. package/dist/needle-engine.umd.cjs +1 -1
  10. package/lib/engine/api.d.ts +5 -0
  11. package/lib/engine/api.js +4 -0
  12. package/lib/engine/api.js.map +1 -1
  13. package/lib/engine/codegen/register_types.js +2 -10
  14. package/lib/engine/codegen/register_types.js.map +1 -1
  15. package/lib/engine/engine_audio.d.ts +68 -0
  16. package/lib/engine/engine_audio.js +172 -0
  17. package/lib/engine/engine_audio.js.map +1 -1
  18. package/lib/engine/engine_components.js +1 -1
  19. package/lib/engine/engine_components.js.map +1 -1
  20. package/lib/engine/engine_context.d.ts +1 -1
  21. package/lib/engine/engine_context.js +2 -2
  22. package/lib/engine/engine_context.js.map +1 -1
  23. package/lib/engine/engine_disposable.d.ts +171 -0
  24. package/lib/engine/engine_disposable.js +136 -0
  25. package/lib/engine/engine_disposable.js.map +1 -0
  26. package/lib/engine/engine_gameobject.d.ts +1 -10
  27. package/lib/engine/engine_gameobject.js +22 -120
  28. package/lib/engine/engine_gameobject.js.map +1 -1
  29. package/lib/engine/engine_gltf_builtin_components.js +7 -69
  30. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  31. package/lib/engine/engine_init.js +6 -6
  32. package/lib/engine/engine_init.js.map +1 -1
  33. package/lib/engine/engine_input.d.ts +1 -1
  34. package/lib/engine/engine_input.js +1 -1
  35. package/lib/engine/engine_input.js.map +1 -1
  36. package/lib/engine/engine_instantiate_resolve.d.ts +42 -0
  37. package/lib/engine/engine_instantiate_resolve.js +372 -0
  38. package/lib/engine/engine_instantiate_resolve.js.map +1 -0
  39. package/lib/engine/engine_license.js +1 -1
  40. package/lib/engine/engine_license.js.map +1 -1
  41. package/lib/engine/engine_mainloop_utils.js +5 -2
  42. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  43. package/lib/engine/engine_networking.js +3 -1
  44. package/lib/engine/engine_networking.js.map +1 -1
  45. package/lib/engine/engine_networking_blob.js +1 -1
  46. package/lib/engine/engine_networking_blob.js.map +1 -1
  47. package/lib/engine/engine_physics_rapier.d.ts +11 -3
  48. package/lib/engine/engine_physics_rapier.js +88 -25
  49. package/lib/engine/engine_physics_rapier.js.map +1 -1
  50. package/lib/engine/engine_scenedata.js +2 -2
  51. package/lib/engine/engine_scenedata.js.map +1 -1
  52. package/lib/engine/engine_serialization_builtin_serializer.js +28 -5
  53. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  54. package/lib/engine/engine_serialization_core.d.ts +1 -0
  55. package/lib/engine/engine_serialization_core.js +7 -0
  56. package/lib/engine/engine_serialization_core.js.map +1 -1
  57. package/lib/engine/engine_types.d.ts +17 -9
  58. package/lib/engine/engine_types.js +1 -1
  59. package/lib/engine/engine_types.js.map +1 -1
  60. package/lib/engine/engine_util_decorator.js +7 -2
  61. package/lib/engine/engine_util_decorator.js.map +1 -1
  62. package/lib/engine/engine_utils.d.ts +1 -1
  63. package/lib/engine/engine_utils.js +19 -5
  64. package/lib/engine/engine_utils.js.map +1 -1
  65. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  66. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
  67. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +1 -1
  68. package/lib/engine/webcomponents/needle menu/needle-menu.js +1 -1
  69. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  70. package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
  71. package/lib/engine/webcomponents/needle-engine.js +1 -1
  72. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  73. package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
  74. package/lib/engine/xr/NeedleXRSession.js +50 -14
  75. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  76. package/lib/engine/xr/events.d.ts +1 -1
  77. package/lib/engine/xr/events.js.map +1 -1
  78. package/lib/engine-components/Animation.js +17 -16
  79. package/lib/engine-components/Animation.js.map +1 -1
  80. package/lib/engine-components/Animator.d.ts +6 -0
  81. package/lib/engine-components/Animator.js +17 -12
  82. package/lib/engine-components/Animator.js.map +1 -1
  83. package/lib/engine-components/AnimatorController.builder.d.ts +113 -0
  84. package/lib/engine-components/AnimatorController.builder.js +195 -0
  85. package/lib/engine-components/AnimatorController.builder.js.map +1 -0
  86. package/lib/engine-components/AnimatorController.d.ts +2 -119
  87. package/lib/engine-components/AnimatorController.js +31 -232
  88. package/lib/engine-components/AnimatorController.js.map +1 -1
  89. package/lib/engine-components/AudioSource.d.ts +19 -3
  90. package/lib/engine-components/AudioSource.js +121 -68
  91. package/lib/engine-components/AudioSource.js.map +1 -1
  92. package/lib/engine-components/Collider.d.ts +18 -9
  93. package/lib/engine-components/Collider.js +61 -14
  94. package/lib/engine-components/Collider.js.map +1 -1
  95. package/lib/engine-components/Component.d.ts +58 -6
  96. package/lib/engine-components/Component.js +77 -0
  97. package/lib/engine-components/Component.js.map +1 -1
  98. package/lib/engine-components/DragControls.d.ts +7 -0
  99. package/lib/engine-components/DragControls.js +19 -7
  100. package/lib/engine-components/DragControls.js.map +1 -1
  101. package/lib/engine-components/EventList.d.ts +31 -9
  102. package/lib/engine-components/EventList.js +37 -76
  103. package/lib/engine-components/EventList.js.map +1 -1
  104. package/lib/engine-components/Joints.d.ts +4 -2
  105. package/lib/engine-components/Joints.js +19 -3
  106. package/lib/engine-components/Joints.js.map +1 -1
  107. package/lib/engine-components/Light.js +9 -1
  108. package/lib/engine-components/Light.js.map +1 -1
  109. package/lib/engine-components/Networking.d.ts +1 -1
  110. package/lib/engine-components/Networking.js +1 -1
  111. package/lib/engine-components/OrbitControls.js +16 -11
  112. package/lib/engine-components/OrbitControls.js.map +1 -1
  113. package/lib/engine-components/RigidBody.d.ts +12 -4
  114. package/lib/engine-components/RigidBody.js +18 -4
  115. package/lib/engine-components/RigidBody.js.map +1 -1
  116. package/lib/engine-components/SeeThrough.js +2 -2
  117. package/lib/engine-components/SeeThrough.js.map +1 -1
  118. package/lib/engine-components/api.d.ts +1 -1
  119. package/lib/engine-components/api.js +1 -1
  120. package/lib/engine-components/api.js.map +1 -1
  121. package/lib/engine-components/codegen/components.d.ts +3 -9
  122. package/lib/engine-components/codegen/components.js +3 -9
  123. package/lib/engine-components/codegen/components.js.map +1 -1
  124. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  125. package/lib/engine-components/timeline/PlayableDirector.d.ts +16 -6
  126. package/lib/engine-components/timeline/PlayableDirector.js +63 -61
  127. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  128. package/lib/engine-components/timeline/SignalAsset.d.ts +3 -1
  129. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  130. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  131. package/lib/engine-components/timeline/TimelineBuilder.d.ts +247 -0
  132. package/lib/engine-components/timeline/TimelineBuilder.js +400 -0
  133. package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -0
  134. package/lib/engine-components/timeline/TimelineModels.d.ts +2 -1
  135. package/lib/engine-components/timeline/TimelineModels.js +3 -0
  136. package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
  137. package/lib/engine-components/timeline/TimelineTracks.d.ts +23 -0
  138. package/lib/engine-components/timeline/TimelineTracks.js +71 -13
  139. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  140. package/lib/engine-components/timeline/index.d.ts +2 -1
  141. package/lib/engine-components/timeline/index.js +2 -0
  142. package/lib/engine-components/timeline/index.js.map +1 -1
  143. package/lib/engine-components/ui/Canvas.d.ts +1 -1
  144. package/lib/engine-components/ui/Canvas.js +2 -8
  145. package/lib/engine-components/ui/Canvas.js.map +1 -1
  146. package/lib/engine-components/ui/Text.d.ts +1 -0
  147. package/lib/engine-components/ui/Text.js +10 -7
  148. package/lib/engine-components/ui/Text.js.map +1 -1
  149. package/lib/engine-components/web/CursorFollow.js +21 -12
  150. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  151. package/lib/engine-components/webxr/WebXRImageTracking.js +4 -0
  152. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  153. package/package.json +2 -83
  154. package/plugins/common/worker.js +9 -4
  155. package/plugins/vite/asap.js +17 -8
  156. package/plugins/vite/dependencies.js +29 -0
  157. package/plugins/vite/dependency-watcher.js +2 -2
  158. package/plugins/vite/editor-connection.js +3 -3
  159. package/plugins/vite/local-files-core.js +3 -3
  160. package/plugins/vite/local-files-utils.d.ts +3 -1
  161. package/plugins/vite/local-files-utils.js +29 -5
  162. package/plugins/vite/reload.js +1 -1
  163. package/plugins/vite/server.js +2 -1
  164. package/src/engine/api.ts +7 -0
  165. package/src/engine/codegen/register_types.ts +2 -10
  166. package/src/engine/engine_audio.ts +184 -0
  167. package/src/engine/engine_components.ts +1 -1
  168. package/src/engine/engine_context.ts +3 -3
  169. package/src/engine/engine_disposable.ts +213 -0
  170. package/src/engine/engine_gameobject.ts +54 -159
  171. package/src/engine/engine_gltf_builtin_components.ts +7 -76
  172. package/src/engine/engine_init.ts +6 -6
  173. package/src/engine/engine_input.ts +1 -1
  174. package/src/engine/engine_instantiate_resolve.ts +407 -0
  175. package/src/engine/engine_license.ts +1 -1
  176. package/src/engine/engine_mainloop_utils.ts +5 -2
  177. package/src/engine/engine_networking.ts +3 -1
  178. package/src/engine/engine_networking_blob.ts +1 -1
  179. package/src/engine/engine_physics_rapier.ts +82 -27
  180. package/src/engine/engine_scenedata.ts +3 -3
  181. package/src/engine/engine_serialization_builtin_serializer.ts +32 -9
  182. package/src/engine/engine_serialization_core.ts +9 -0
  183. package/src/engine/engine_types.ts +22 -13
  184. package/src/engine/engine_util_decorator.ts +7 -2
  185. package/src/engine/engine_utils.ts +16 -5
  186. package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  187. package/src/engine/webcomponents/needle menu/needle-menu.ts +1 -1
  188. package/src/engine/webcomponents/needle-engine.ts +10 -4
  189. package/src/engine/xr/NeedleXRSession.ts +48 -13
  190. package/src/engine/xr/events.ts +1 -1
  191. package/src/engine-components/Animation.ts +19 -16
  192. package/src/engine-components/Animator.ts +18 -11
  193. package/src/engine-components/AnimatorController.builder.ts +261 -0
  194. package/src/engine-components/AnimatorController.ts +19 -291
  195. package/src/engine-components/AudioSource.ts +130 -79
  196. package/src/engine-components/Collider.ts +66 -18
  197. package/src/engine-components/Component.ts +79 -9
  198. package/src/engine-components/DragControls.ts +18 -11
  199. package/src/engine-components/EventList.ts +45 -83
  200. package/src/engine-components/Joints.ts +20 -4
  201. package/src/engine-components/Light.ts +10 -2
  202. package/src/engine-components/Networking.ts +1 -1
  203. package/src/engine-components/OrbitControls.ts +18 -9
  204. package/src/engine-components/RigidBody.ts +18 -4
  205. package/src/engine-components/SeeThrough.ts +2 -2
  206. package/src/engine-components/api.ts +1 -1
  207. package/src/engine-components/codegen/components.ts +3 -9
  208. package/src/engine-components/timeline/PlayableDirector.ts +61 -64
  209. package/src/engine-components/timeline/SignalAsset.ts +4 -1
  210. package/src/engine-components/timeline/TimelineBuilder.ts +565 -0
  211. package/src/engine-components/timeline/TimelineModels.ts +5 -1
  212. package/src/engine-components/timeline/TimelineTracks.ts +74 -13
  213. package/src/engine-components/timeline/index.ts +2 -1
  214. package/src/engine-components/ui/Canvas.ts +2 -8
  215. package/src/engine-components/ui/Text.ts +12 -8
  216. package/src/engine-components/web/CursorFollow.ts +21 -13
  217. package/src/engine-components/webxr/WebXRImageTracking.ts +2 -0
  218. package/dist/needle-engine.bundle-1s2gOoKZ.min.js +0 -1732
  219. package/dist/needle-engine.bundle-j4nGJXCs.umd.cjs +0 -1732
  220. package/lib/engine-components/AvatarLoader.d.ts +0 -80
  221. package/lib/engine-components/AvatarLoader.js +0 -232
  222. package/lib/engine-components/AvatarLoader.js.map +0 -1
  223. package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +0 -11
  224. package/lib/engine-components/avatar/AvatarBlink_Simple.js +0 -77
  225. package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +0 -1
  226. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +0 -14
  227. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +0 -69
  228. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +0 -1
  229. package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +0 -29
  230. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +0 -122
  231. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +0 -1
  232. package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +0 -15
  233. package/lib/engine-components/avatar/Avatar_MouthShapes.js +0 -80
  234. package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +0 -1
  235. package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +0 -9
  236. package/lib/engine-components/avatar/Avatar_MustacheShake.js +0 -30
  237. package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +0 -1
  238. package/src/engine-components/AvatarLoader.ts +0 -264
  239. package/src/engine-components/avatar/AvatarBlink_Simple.ts +0 -70
  240. package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +0 -64
  241. package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +0 -140
  242. package/src/engine-components/avatar/Avatar_MouthShapes.ts +0 -84
  243. package/src/engine-components/avatar/Avatar_MustacheShake.ts +0 -32
@@ -40,6 +40,7 @@ import { GLTFLoader } from '../../../node_modules/@types/three/examples/jsm/load
40
40
  import { GLTFLoaderPlugin } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
41
41
  import { GLTFParser } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
42
42
  import { Group } from 'three';
43
+ import { ImpulseJoint } from '@dimforge/rapier3d-compat';
43
44
  import { InstancedMesh } from 'three';
44
45
  import { Intersection } from 'three';
45
46
  import { IParticleSystem as IParticleSystem_2 } from 'three.quarks';
@@ -254,6 +255,24 @@ export declare class ActionModel implements IBehaviorElement {
254
255
  writeTo(document: USDDocument, writer: USDWriter): void;
255
256
  }
256
257
 
258
+ /**
259
+ * Options for an activation clip in the timeline builder
260
+ */
261
+ export declare type ActivationClipOptions = {
262
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
263
+ start?: number;
264
+ /** Duration of the clip in seconds (required) */
265
+ duration: number;
266
+ /** Ease-in duration in seconds (default: 0) */
267
+ easeIn?: number;
268
+ /** Ease-out duration in seconds (default: 0) */
269
+ easeOut?: number;
270
+ };
271
+
272
+ export declare class ActivationTrackHandler extends TrackHandler {
273
+ evaluate(time: number): void;
274
+ }
275
+
257
276
  export declare const activeInHierarchyFieldName = "needle_isActiveInHierarchy";
258
277
 
259
278
  /**
@@ -500,6 +519,34 @@ export declare type AnimationClipModel = {
500
519
  rotation?: Quat | Quaternion;
501
520
  };
502
521
 
522
+ /**
523
+ * Options for an animation clip in the timeline builder
524
+ */
525
+ export declare type AnimationClipOptions = {
526
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
527
+ start?: number;
528
+ /** Duration of the clip in seconds. Defaults to the animation clip duration. */
529
+ duration?: number;
530
+ /** Playback speed multiplier (default: 1) */
531
+ speed?: number;
532
+ /** Whether the animation should loop within the clip (default: false) */
533
+ loop?: boolean;
534
+ /** Ease-in duration in seconds (default: 0) */
535
+ easeIn?: number;
536
+ /** Ease-out duration in seconds (default: 0) */
537
+ easeOut?: number;
538
+ /** Offset into the source animation clip in seconds (default: 0) */
539
+ clipIn?: number;
540
+ /** Whether to remove the start offset of the animation (default: false) */
541
+ removeStartOffset?: boolean;
542
+ /** Pre-extrapolation mode (default: None) */
543
+ preExtrapolation?: ClipExtrapolation;
544
+ /** Post-extrapolation mode (default: None) */
545
+ postExtrapolation?: ClipExtrapolation;
546
+ /** Play the clip in reverse */
547
+ reversed?: boolean;
548
+ };
549
+
503
550
  /**
504
551
  * AnimationCurve is a representation of a curve that can be used to animate values over time.
505
552
  *
@@ -726,6 +773,12 @@ export declare class Animator extends Component implements IAnimationComponent {
726
773
  * Identifies this component as an animation component in the engine
727
774
  */
728
775
  get isAnimationComponent(): boolean;
776
+ /**
777
+ * The current animator mixer, used for low-level control of animations. Owned by the AnimatorController
778
+ * @returns The current AnimationMixer, or null if no controller is assigned
779
+ * @see AnimatorController.mixer
780
+ */
781
+ get mixer(): AnimationMixer | null;
729
782
  /**
730
783
  * When enabled, animation will affect the root transform position and rotation
731
784
  */
@@ -1102,13 +1155,6 @@ export declare class AnimatorController {
1102
1155
  * @param animator - The animator to bind this controller to
1103
1156
  */
1104
1157
  bind(animator: Animator): void;
1105
- /**
1106
- * Creates a deep copy of this controller.
1107
- * Clones the model data but does not copy runtime state.
1108
- *
1109
- * @returns A new AnimatorController instance with the same configuration
1110
- */
1111
- clone(): AnimatorController | null;
1112
1158
  /**
1113
1159
  * Updates the controller's state machine and animations.
1114
1160
  * Called each frame by the animator component.
@@ -1472,6 +1518,75 @@ export declare class Attractor extends Component {
1472
1518
 
1473
1519
  declare type AttributeChangeCallback = (value: string | null) => void;
1474
1520
 
1521
+ /**
1522
+ * Represents an audio clip that can be loaded and played independently.
1523
+ * The AudioClip class encapsulates the URL of the audio resource and provides
1524
+ * methods for playback control (play, pause, stop) and querying duration.
1525
+ */
1526
+ export declare class AudioClip {
1527
+ readonly url: string;
1528
+ /**
1529
+ * Creates a new AudioClip instance with the specified URL.
1530
+ * @param url The URL of the audio resource to load. This can be a path to an audio file or a MediaStream URL.
1531
+ */
1532
+ constructor(url: string);
1533
+ /** Whether the clip is currently playing.
1534
+ * @returns `true` if the clip is actively playing audio.
1535
+ */
1536
+ get isPlaying(): boolean;
1537
+ /**
1538
+ * The total duration of the audio clip in seconds.
1539
+ * Loads the audio metadata if not already available.
1540
+ * @returns A promise that resolves with the duration in seconds.
1541
+ */
1542
+ getDuration(): Promise<number>;
1543
+ /**
1544
+ * Plays the audio clip from the current position.
1545
+ * @returns A promise that resolves when playback finishes, or rejects on error.
1546
+ * If the clip is looping, the promise will never resolve on its own – call {@link stop} or {@link pause} to end playback.
1547
+ */
1548
+ play(): Promise<void>;
1549
+ /**
1550
+ * Pauses playback at the current position.
1551
+ * Call {@link play} to resume.
1552
+ */
1553
+ pause(): void;
1554
+ /**
1555
+ * Stops playback and resets the position to the beginning.
1556
+ */
1557
+ stop(): void;
1558
+ /** Whether the clip should loop when reaching the end. */
1559
+ get loop(): boolean;
1560
+ set loop(value: boolean);
1561
+ /** Playback volume from 0 (silent) to 1 (full). */
1562
+ get volume(): number;
1563
+ set volume(value: number);
1564
+ /** Current playback position in seconds. */
1565
+ get currentTime(): number;
1566
+ set currentTime(value: number);
1567
+ /** Normalized playback progress from 0 to 1.
1568
+ * @returns The current playback position as a value between 0 and 1, or 0 if the duration is unknown.
1569
+ */
1570
+ get progress(): number;
1571
+ /**
1572
+ * Seeks to a normalized position (0–1) in the clip.
1573
+ * @param position A value between 0 (start) and 1 (end).
1574
+ */
1575
+ seek(position: number): void;
1576
+ /** The underlying HTMLAudioElement, or `undefined` if not yet created.
1577
+ * Use this to connect the element to the Web Audio API via `createMediaElementSource()`.
1578
+ * @returns The HTMLAudioElement if the clip has been loaded or played, otherwise `undefined`.
1579
+ */
1580
+ get audioElement(): HTMLAudioElement | undefined;
1581
+ private _audioElement?;
1582
+ private _duration?;
1583
+ private _loadPromise?;
1584
+ private _loop;
1585
+ private _volume;
1586
+ /** Lazily creates and loads the shared HTMLAudioElement. */
1587
+ private ensureAudioElement;
1588
+ }
1589
+
1475
1590
  /**
1476
1591
  * @category Animation and Sequencing
1477
1592
  * @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
@@ -1486,6 +1601,26 @@ declare type AudioClipModel_2 = Models.ClipModel & {
1486
1601
  _didTriggerPlay: boolean;
1487
1602
  };
1488
1603
 
1604
+ /**
1605
+ * Options for an audio clip in the timeline builder
1606
+ */
1607
+ export declare type AudioClipOptions = {
1608
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
1609
+ start?: number;
1610
+ /** Duration of the clip in seconds (required for audio since we can't infer it) */
1611
+ duration: number;
1612
+ /** Playback speed multiplier (default: 1) */
1613
+ speed?: number;
1614
+ /** Volume multiplier for this clip (default: 1) */
1615
+ volume?: number;
1616
+ /** Whether the audio should loop within the clip (default: false) */
1617
+ loop?: boolean;
1618
+ /** Ease-in duration in seconds (default: 0) */
1619
+ easeIn?: number;
1620
+ /** Ease-out duration in seconds (default: 0) */
1621
+ easeOut?: number;
1622
+ };
1623
+
1489
1624
  export declare class AudioExtension implements IUSDExporterExtension {
1490
1625
  static getName(clip: string): string;
1491
1626
  get extensionName(): string;
@@ -1627,9 +1762,10 @@ export declare class AudioSource extends Component {
1627
1762
  */
1628
1763
  get isPlaying(): boolean;
1629
1764
  /**
1630
- * The total duration of the current audio clip in seconds.
1765
+ * The total duration of the currently loaded audio clip in seconds.
1631
1766
  *
1632
1767
  * @returns Duration in seconds or undefined if no clip is loaded
1768
+ * @remarks For MediaStream clips, duration is not directly available and will return undefined. If the audio clip has not started loading or is still loading, duration may also be undefined until the audio buffer is ready.
1633
1769
  */
1634
1770
  get duration(): number | undefined;
1635
1771
  /**
@@ -1654,7 +1790,8 @@ export declare class AudioSource extends Component {
1654
1790
  /**
1655
1791
  * Controls how the audio is positioned in space.
1656
1792
  * Values range from 0 (2D, non-positional) to 1 (fully 3D positioned).
1657
- * Note: 2D playback is not fully supported in the current implementation.
1793
+ * Internally uses a dual-path audio graph to crossfade between a spatialized (PannerNode)
1794
+ * and a non-spatialized (direct) signal path.
1658
1795
  */
1659
1796
  get spatialBlend(): number;
1660
1797
  set spatialBlend(val: number);
@@ -1702,7 +1839,11 @@ export declare class AudioSource extends Component {
1702
1839
  private audioLoader;
1703
1840
  private shouldPlay;
1704
1841
  private _lastClipStartedLoading;
1842
+ private _loadedClip;
1705
1843
  private _audioElement;
1844
+ private _entryNode;
1845
+ private _spatialGain;
1846
+ private _bypassGain;
1706
1847
  /**
1707
1848
  * Returns the underlying {@link PositionalAudio} object, creating it if necessary.
1708
1849
  * The audio source needs a user interaction to be initialized due to browser autoplay policies.
@@ -1730,6 +1871,15 @@ export declare class AudioSource extends Component {
1730
1871
  private onApplicationMuteChanged;
1731
1872
  private createAudio;
1732
1873
  private __onAllowAudioCallback;
1874
+ /**
1875
+ * Sets up the dual-path audio graph for spatial blend crossfading.
1876
+ * Creates two parallel signal paths from source to output:
1877
+ * - 3D path: entry → panner → spatialGain → gain (spatialized)
1878
+ * - 2D path: entry → bypassGain → gain (non-spatialized)
1879
+ */
1880
+ private setupSpatialBlendNodes;
1881
+ /** Updates the spatial/bypass gain values based on the current spatialBlend. */
1882
+ private updateSpatialBlendGains;
1733
1883
  private applySpatialDistanceSettings;
1734
1884
  private onNewClip;
1735
1885
  /**
@@ -1737,8 +1887,9 @@ export declare class AudioSource extends Component {
1737
1887
  * If no argument is provided, plays the currently assigned clip.
1738
1888
  *
1739
1889
  * @param clip - Optional audio clip or {@link MediaStream} to play
1890
+ * @returns A promise that resolves when playback starts successfully, or rejects on error
1740
1891
  */
1741
- play(clip?: string | MediaStream | undefined): void;
1892
+ play(clip?: string | MediaStream | undefined): Promise<boolean>;
1742
1893
  /**
1743
1894
  * Pauses audio playback while maintaining the current position.
1744
1895
  * Use play() to resume from the paused position.
@@ -1755,6 +1906,20 @@ export declare class AudioSource extends Component {
1755
1906
  /* Excluded from this release type: update */
1756
1907
  }
1757
1908
 
1909
+ /**
1910
+ * Handles audio playback for a timeline audio track.
1911
+ *
1912
+ * **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
1913
+ * You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
1914
+ * at any time — changes take effect on the next frame without rebuilding the timeline.
1915
+ *
1916
+ * **Audio stopping:** Audio clips are automatically stopped when:
1917
+ * - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
1918
+ * - The track is muted (via `muted = true`)
1919
+ * - The director is stopped (`director.stop()`)
1920
+ * - The director is paused (`director.pause()`)
1921
+ * - The director is disabled or destroyed
1922
+ */
1758
1923
  export declare class AudioTrackHandler extends TrackHandler {
1759
1924
  models: Array<AudioClipModel_2>;
1760
1925
  listener: AudioListener_3;
@@ -1762,6 +1927,9 @@ export declare class AudioTrackHandler extends TrackHandler {
1762
1927
  audioContextTimeOffset: Array<number>;
1763
1928
  lastTime: number;
1764
1929
  audioSource?: AudioSource;
1930
+ /** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
1931
+ get volume(): number;
1932
+ set volume(val: number);
1765
1933
  private _audioLoader;
1766
1934
  private getAudioFilePath;
1767
1935
  onAllowAudioChanged(allow: boolean): void;
@@ -1811,69 +1979,6 @@ export declare class Avatar extends Component {
1811
1979
  private loadAvatarObjects;
1812
1980
  }
1813
1981
 
1814
- /* Excluded from this release type: Avatar_Brain_LookAt */
1815
-
1816
- /* Excluded from this release type: Avatar_MouthShapes */
1817
-
1818
- /* Excluded from this release type: Avatar_MustacheShake */
1819
-
1820
- /* Excluded from this release type: Avatar_POI */
1821
-
1822
- /* Excluded from this release type: AvatarBlink_Simple */
1823
-
1824
- /* Excluded from this release type: AvatarEyeLook_Rotation */
1825
-
1826
- /**
1827
- * Handles loading and instantiating avatar models from various sources.
1828
- * Provides functionality to find and extract important parts of an avatar (head, hands).
1829
- *
1830
- * Debug mode can be enabled with the URL parameter `?debugavatar`,
1831
- * which will log detailed information about avatar loading and configuration.
1832
- */
1833
- export declare class AvatarLoader {
1834
- private readonly avatarRegistryUrl;
1835
- /**
1836
- * Retrieves or creates a new avatar instance from an ID or existing Object3D.
1837
- * @param context The application context
1838
- * @param avatarId Either a string ID to load an avatar or an existing Object3D to use as avatar
1839
- * @returns Promise resolving to an AvatarModel if successful, or null if failed
1840
- */
1841
- getOrCreateNewAvatarInstance(context: Context, avatarId: string | Object3D): Promise<AvatarModel | null>;
1842
- /**
1843
- * Loads an avatar model from a file or registry using the provided ID.
1844
- * @param context The engine context
1845
- * @param avatarId The ID of the avatar to load
1846
- * @returns Promise resolving to the loaded avatar's Object3D, or null if failed
1847
- */
1848
- private loadAvatar;
1849
- /**
1850
- * Caches an avatar model for reuse.
1851
- * @param _id The ID to associate with the model
1852
- * @param _model The avatar model to cache
1853
- */
1854
- private cacheModel;
1855
- /**
1856
- * Analyzes an Object3D to find avatar parts (head, hands) based on naming conventions.
1857
- * @param obj The Object3D to search for avatar parts
1858
- * @returns A structured AvatarModel with references to found parts
1859
- */
1860
- private findAvatar;
1861
- /**
1862
- * Recursively searches for an avatar part by name within an Object3D hierarchy.
1863
- * @param obj The Object3D to search within
1864
- * @param searchString Array of strings that should all be present in the object name
1865
- * @returns The found Object3D part or null if not found
1866
- */
1867
- private findAvatarPart;
1868
- /**
1869
- * Handles HTTP response errors from avatar loading operations.
1870
- * @param response The fetch API response to check
1871
- * @returns The response if it was ok
1872
- * @throws Error with status text if response was not ok
1873
- */
1874
- private handleCustomAvatarErrors;
1875
- }
1876
-
1877
1982
  /**
1878
1983
  * Marks a GameObject as being controlled or owned by a player in networked XR sessions.
1879
1984
  * This is used internally by the networking system to identify player-controlled objects.
@@ -1934,35 +2039,6 @@ declare type AvatarMarkerEventArgs = {
1934
2039
  gameObject: Object3D;
1935
2040
  };
1936
2041
 
1937
- /**
1938
- * Represents an avatar model with head and hands references.
1939
- * Used for representing characters in 3D space.
1940
- */
1941
- export declare class AvatarModel {
1942
- /** The root object of the avatar model */
1943
- root: Object3D;
1944
- /** The head object of the avatar model */
1945
- head: Object3D;
1946
- /** The left hand object of the avatar model, if available */
1947
- leftHand: Object3D | null;
1948
- /** The right hand object of the avatar model, if available */
1949
- rigthHand: Object3D | null;
1950
- /**
1951
- * Checks if the avatar model has a valid configuration.
1952
- * An avatar is considered valid if it has a head.
1953
- * @returns Whether the avatar has a valid setup
1954
- */
1955
- get isValid(): boolean;
1956
- /**
1957
- * Creates a new avatar model.
1958
- * @param root The root object of the avatar
1959
- * @param head The head object of the avatar
1960
- * @param leftHand The left hand object of the avatar
1961
- * @param rigthHand The right hand object of the avatar
1962
- */
1963
- constructor(root: Object3D, head: Object3D, leftHand: Object3D | null, rigthHand: Object3D | null);
1964
- }
1965
-
1966
2042
  export declare enum Axes {
1967
2043
  None = 0,
1968
2044
  X = 2,
@@ -2326,7 +2402,6 @@ export declare class BoxCollider extends Collider implements IBoxCollider {
2326
2402
  center: Vector3;
2327
2403
  /* Excluded from this release type: onEnable */
2328
2404
  /* Excluded from this release type: onDisable */
2329
- /* Excluded from this release type: onValidate */
2330
2405
  /**
2331
2406
  * Automatically fits the collider to the geometry of the object.
2332
2407
  * Sets the size and center based on the object's bounding box.
@@ -2600,6 +2675,7 @@ declare class CallHandle extends EventDispatcher<any> {
2600
2675
  * CallInfo represents a single callback method that can be invoked by the {@link EventList}.
2601
2676
  */
2602
2677
  export declare class CallInfo {
2678
+ $serializedTypes: Record<string, any>;
2603
2679
  /**
2604
2680
  * When the CallInfo is enabled it will be invoked when the EventList is invoked
2605
2681
  */
@@ -2946,7 +3022,7 @@ export declare class Canvas extends UIRootComponent implements ICanvas {
2946
3022
  private _receivers;
2947
3023
  registerEventReceiver(receiver: ICanvasEventReceiver): void;
2948
3024
  unregisterEventReceiver(receiver: ICanvasEventReceiver): void;
2949
- onEnterXR(args: NeedleXREventArgs): Promise<void>;
3025
+ onEnterXR(args: NeedleXREventArgs): void;
2950
3026
  onLeaveXR(args: NeedleXREventArgs): void;
2951
3027
  onBeforeRenderRoutine: () => void;
2952
3028
  onAfterRenderRoutine: () => void;
@@ -3522,6 +3598,22 @@ export declare abstract class Collider extends Component implements ICollider {
3522
3598
  * The layers that this collider will interact with. Used for filtering collision detection.
3523
3599
  */
3524
3600
  filter?: number[];
3601
+ /**
3602
+ * The density of the collider, used for automatic mass calculation when the attached {@link Rigidbody} has `autoMass` enabled.
3603
+ * Rapier computes mass from density using the real-world formula: `mass = density × volume`.
3604
+ * The volume is derived from the collider shape (sphere, box, capsule, or convex hull).
3605
+ *
3606
+ * Reference values (relative to water = 1.0):
3607
+ * - Wood: 0.5–0.9
3608
+ * - Water: 1.0 (engine default)
3609
+ * - Rubber: 1.2
3610
+ * - Steel: 7.8
3611
+ *
3612
+ * @default undefined — uses the physics engine default of 1.0
3613
+ */
3614
+ density?: number;
3615
+ /* Excluded from this release type: _propertiesDirty */
3616
+ /* Excluded from this release type: onValidate */
3525
3617
  /* Excluded from this release type: awake */
3526
3618
  /* Excluded from this release type: start */
3527
3619
  /* Excluded from this release type: onEnable */
@@ -3707,6 +3799,62 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
3707
3799
  * @returns True if the component is enabled and all parent GameObjects are active
3708
3800
  */
3709
3801
  get activeAndEnabled(): boolean;
3802
+ private __disableCleanups?;
3803
+ private __destroyCleanups?;
3804
+ /**
3805
+ * Register a resource for automatic cleanup tied to this component's lifecycle.
3806
+ * Accepts {@link IDisposable} objects, cleanup functions, or event unsubscribe functions.
3807
+ * `null` and `undefined` are safe no-ops (convenient for conditional subscriptions).
3808
+ *
3809
+ * **Lifecycle-aware:** The cleanup store is chosen automatically based on when `autoCleanup` is called:
3810
+ * - Called during {@link onEnable} → cleaned up on {@link onDisable} (and re-registered on re-enable)
3811
+ * - Called during {@link awake} or {@link start} → cleaned up on {@link onDestroy} (survives enable/disable cycles)
3812
+ * - Called at any other time (e.g. from update) → cleaned up on {@link onDisable}
3813
+ *
3814
+ * @param disposable An {@link IDisposable}, a cleanup/unsubscribe function, or `null`/`undefined`
3815
+ *
3816
+ * @example DOM events with on() — fully typed
3817
+ * ```ts
3818
+ * import { Behaviour, on } from "@needle-tools/engine";
3819
+ *
3820
+ * export class JsonLoader extends Behaviour {
3821
+ * onEnable() {
3822
+ * this.autoCleanup(on(window, "resize", (ev) => this.onResize(ev)));
3823
+ * this.autoCleanup(on(document, "keydown", (ev) => this.onKey(ev)));
3824
+ * }
3825
+ * // Listeners removed automatically on disable — no manual cleanup!
3826
+ * }
3827
+ * ```
3828
+ *
3829
+ * @example EventList subscriptions
3830
+ * ```ts
3831
+ * import { Behaviour, serializable, EventList } from "@needle-tools/engine";
3832
+ *
3833
+ * export class MyComponent extends Behaviour {
3834
+ * @serializable(EventList)
3835
+ * onScoreChanged?: EventList<number>;
3836
+ *
3837
+ * onEnable() {
3838
+ * this.autoCleanup(this.onScoreChanged?.on(score => {
3839
+ * console.log("Score:", score);
3840
+ * }));
3841
+ * }
3842
+ * }
3843
+ * ```
3844
+ *
3845
+ * @example Lifetime subscriptions in awake
3846
+ * ```ts
3847
+ * import { Behaviour, on } from "@needle-tools/engine";
3848
+ *
3849
+ * export class Persistent extends Behaviour {
3850
+ * awake() {
3851
+ * // Registered during awake → survives enable/disable, cleaned up on destroy
3852
+ * this.autoCleanup(on(window, "beforeunload", () => this.save()));
3853
+ * }
3854
+ * }
3855
+ * ```
3856
+ */
3857
+ protected autoCleanup(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
3710
3858
  private get __isActive();
3711
3859
  private get __isActiveInHierarchy();
3712
3860
  private set __isActiveInHierarchy(value);
@@ -3725,11 +3873,6 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
3725
3873
  * For example, URL to the glTF file this component was loaded from
3726
3874
  */
3727
3875
  sourceId?: SourceIdentifier;
3728
- /**
3729
- * Called when this component needs to remap guids after an instantiate operation.
3730
- * @param guidsMap Mapping from old guids to newly generated guids
3731
- */
3732
- resolveGuids?(guidsMap: GuidsMap): void;
3733
3876
  /**
3734
3877
  * Called once when the component becomes active for the first time.
3735
3878
  * This is the first lifecycle callback to be invoked
@@ -4806,6 +4949,20 @@ export declare type ControlClipModel = {
4806
4949
  updateDirector: boolean;
4807
4950
  };
4808
4951
 
4952
+ /**
4953
+ * Options for a control clip in the timeline builder
4954
+ */
4955
+ export declare type ControlClipOptions = {
4956
+ /** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
4957
+ start?: number;
4958
+ /** Duration of the clip in seconds (required) */
4959
+ duration: number;
4960
+ /** Whether to control the activation of the source object (default: true) */
4961
+ controlActivation?: boolean;
4962
+ /** Whether to update a nested PlayableDirector on the source object (default: true) */
4963
+ updateDirector?: boolean;
4964
+ };
4965
+
4809
4966
  /** true when selectstart was ever received.
4810
4967
  * On VisionOS 1.1 we always have select events (as per the spec), so this is always true
4811
4968
  */
@@ -5136,7 +5293,7 @@ export declare function decompressGpuTexture(texture: any, maxTextureSize?: numb
5136
5293
  * return true;
5137
5294
  * });
5138
5295
  * */
5139
- export declare function deepClone(obj: any, predicate?: deepClonePredicate): any;
5296
+ export declare function deepClone(obj: any, predicate?: deepClonePredicate, _visited?: WeakSet<object>): any;
5140
5297
 
5141
5298
  declare type deepClonePredicate = (owner: any, propertyName: string, current: any) => boolean;
5142
5299
 
@@ -5364,7 +5521,7 @@ export declare namespace DeviceUtilities {
5364
5521
  * Controls how the {@link PlayableDirector} behaves when playback reaches the end.
5365
5522
  * @see {@link PlayableDirector.extrapolationMode}
5366
5523
  */
5367
- declare enum DirectorWrapMode {
5524
+ export declare enum DirectorWrapMode {
5368
5525
  /** Hold the last frame when playback reaches the end of the timeline. */
5369
5526
  Hold = 0,
5370
5527
  /** Loop back to the start and continue playing indefinitely. */
@@ -5373,6 +5530,101 @@ declare enum DirectorWrapMode {
5373
5530
  None = 2
5374
5531
  }
5375
5532
 
5533
+ /**
5534
+ * A store for managing disposable resources (event subscriptions, listeners, callbacks)
5535
+ * that should be cleaned up together.
5536
+ *
5537
+ * DisposableStore collects disposables and disposes them all at once when
5538
+ * {@link dispose} is called. After disposal, the store can be reused — new items
5539
+ * can be added and a subsequent {@link dispose} call will clean those up.
5540
+ *
5541
+ * This is the same pattern used internally by VSCode for lifecycle-bound resource management.
5542
+ *
5543
+ * @example Basic usage
5544
+ * ```ts
5545
+ * import { DisposableStore, on } from "@needle-tools/engine";
5546
+ *
5547
+ * const store = new DisposableStore();
5548
+ *
5549
+ * // Register a DOM event listener (typed!)
5550
+ * store.add(on(window, "resize", (ev) => console.log(ev)));
5551
+ *
5552
+ * // Register the return value of EventList.on()
5553
+ * store.add(myEventList.on(data => console.log(data)));
5554
+ *
5555
+ * // Register a raw cleanup function
5556
+ * store.add(() => someSDK.off("event", handler));
5557
+ *
5558
+ * // Later: dispose everything at once
5559
+ * store.dispose();
5560
+ * ```
5561
+ *
5562
+ * @example Use with Needle Engine components
5563
+ * ```ts
5564
+ * import { Behaviour, serializable, EventList, on } from "@needle-tools/engine";
5565
+ *
5566
+ * export class MyComponent extends Behaviour {
5567
+ * @serializable(EventList)
5568
+ * onClick?: EventList;
5569
+ *
5570
+ * onEnable() {
5571
+ * // DOM events — fully typed
5572
+ * this.autoCleanup(on(window, "resize", (ev) => this.onResize(ev)));
5573
+ *
5574
+ * // EventList — .on() returns a function, autoCleanup accepts it
5575
+ * this.autoCleanup(this.onClick?.on(() => console.log("clicked!")));
5576
+ * }
5577
+ * // No onDisable needed — cleaned up automatically!
5578
+ * }
5579
+ * ```
5580
+ *
5581
+ * @category Utilities
5582
+ * @group Lifecycle
5583
+ */
5584
+ export declare class DisposableStore implements IDisposable {
5585
+ private _disposables;
5586
+ /** The number of registered disposables */
5587
+ get size(): number;
5588
+ /**
5589
+ * Register a disposable resource. Accepts:
5590
+ * - An {@link IDisposable} object (has a `dispose()` method) — e.g. from {@link on}
5591
+ * - A cleanup function (e.g. return value of `EventList.on()`)
5592
+ * - `null` or `undefined` (safe no-op for conditional subscriptions)
5593
+ *
5594
+ * When {@link dispose} is called, all registered resources are cleaned up.
5595
+ *
5596
+ * @param disposable The resource to register for disposal
5597
+ *
5598
+ * @example
5599
+ * ```ts
5600
+ * const store = new DisposableStore();
5601
+ *
5602
+ * // IDisposable object from on()
5603
+ * store.add(on(window, "resize", handler));
5604
+ *
5605
+ * // Function returned by EventList.on()
5606
+ * store.add(myEvent.on(handler));
5607
+ *
5608
+ * // Raw cleanup function
5609
+ * store.add(() => connection.close());
5610
+ *
5611
+ * // Conditional — safe with undefined
5612
+ * store.add(this.maybeEvent?.on(handler));
5613
+ * ```
5614
+ */
5615
+ add(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
5616
+ /**
5617
+ * Dispose all registered resources. Each registered disposable is cleaned up,
5618
+ * then the internal list is cleared. The store can be reused after disposal.
5619
+ *
5620
+ * Called automatically by the engine when a component's `onDisable` lifecycle fires.
5621
+ */
5622
+ dispose(): void;
5623
+ }
5624
+
5625
+ /** A function that performs cleanup when called */
5626
+ export declare type DisposeFn = () => void;
5627
+
5376
5628
  /** Recursive disposes all referenced resources by this object. Does not traverse children */
5377
5629
  export declare function disposeObjectResources(obj: object | null | undefined): void;
5378
5630
 
@@ -5480,6 +5732,12 @@ export declare class DragControls extends Component implements IPointerEventHand
5480
5732
  * providing visual feedback about the object's position relative to surfaces below it.
5481
5733
  */
5482
5734
  showGizmo: boolean;
5735
+ /** Invoked once when a drag begins (after the minimum drag distance threshold is met). */
5736
+ dragStarted: EventList;
5737
+ /** Invoked every frame while the object is being dragged. */
5738
+ dragUpdated: EventList;
5739
+ /** Invoked once when the last pointer is released and the drag ends. */
5740
+ dragEnded: EventList;
5483
5741
  /**
5484
5742
  * Returns the object currently being dragged by this DragControls component, if any.
5485
5743
  * @returns The object being dragged or null if no object is currently dragged
@@ -5966,13 +6224,9 @@ export declare class EnvironmentScene extends Scene {
5966
6224
  * @see {@link Button} for UI button events
5967
6225
  */
5968
6226
  export declare class EventList<TArgs extends any = any> implements IEventList {
6227
+ $serializedTypes: Record<string, any>;
5969
6228
  /** checked during instantiate to create a new instance */
5970
6229
  readonly isEventList = true;
5971
- /* Excluded from this release type: __internalOnInstantiate */
5972
- private target?;
5973
- private key?;
5974
- /** set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked */
5975
- setEventTarget(key: string, target: object): void;
5976
6230
  /** How many callback methods are subscribed to this event */
5977
6231
  get listenerCount(): number;
5978
6232
  /** If the event is currently being invoked */
@@ -6005,13 +6259,41 @@ export declare class EventList<TArgs extends any = any> implements IEventList {
6005
6259
  invoke(...args: Array<TArgs>): boolean;
6006
6260
  /** Add a new event listener to this event
6007
6261
  * @returns a function to remove the event listener
6262
+ * @see {@link removeEventListener} for more details and return value information
6263
+ * @see {@link off} for an alias with better readability when unsubscribing from events
6264
+ * @example
6265
+ * ```ts
6266
+ * const off = myEvent.addEventListener(args => console.log("Clicked!", args));
6267
+ * // later
6268
+ * off();
6269
+ * ```
6008
6270
  */
6009
6271
  addEventListener(callback: (args: TArgs) => void): Function;
6272
+ /**
6273
+ * Alias for addEventListener for better readability when subscribing to events. You can use it like this:
6274
+ * ```ts
6275
+ * myEvent.on(args => console.log("Clicked!", args));
6276
+ * ```
6277
+ * @returns a function to remove the event listener
6278
+ * @see {@link addEventListener} for more details and return value information
6279
+ */
6280
+ on(callback: (args: TArgs) => void): Function;
6010
6281
  /**
6011
6282
  * Remove an event listener from this event.
6012
6283
  * @returns true if the event listener was found and removed, false otherwise
6013
6284
  */
6014
6285
  removeEventListener(fn: Function | null | undefined): boolean;
6286
+ /**
6287
+ * Alias for removeEventListener for better readability when unsubscribing from events. You can use it like this:
6288
+ * ```ts
6289
+ * const off = myEvent.on(args => console.log("Clicked!", args));
6290
+ * // later
6291
+ * off();
6292
+ * ```
6293
+ *
6294
+ * @see {@link removeEventListener} for more details and return value information
6295
+ */
6296
+ off(callback: Function | null | undefined): boolean;
6015
6297
  /**
6016
6298
  * Remove all event listeners from this event. Use with caution! This will remove all listeners!
6017
6299
  */
@@ -6042,6 +6324,7 @@ declare type EventListenerOptions_2 = {
6042
6324
  signal?: AbortSignal;
6043
6325
  };
6044
6326
 
6327
+ /** @deprecated No longer automatically dispatched. Use `eventList.on()` directly instead. */
6045
6328
  export declare class EventListEvent<TArgs extends any> extends Event {
6046
6329
  args?: TArgs;
6047
6330
  }
@@ -6495,7 +6778,7 @@ declare type FitParameters = {
6495
6778
  * @see {@link HingeJoint} for rotating connections
6496
6779
  */
6497
6780
  export declare class FixedJoint extends Joint {
6498
- protected createJoint(self: Rigidbody, other: Rigidbody): void;
6781
+ protected createJoint(self: Rigidbody, other: Rigidbody): any;
6499
6782
  }
6500
6783
 
6501
6784
  declare type FocusRect = DOMRect | Element | {
@@ -7746,7 +8029,7 @@ export declare class HingeJoint extends Joint {
7746
8029
  anchor?: Vector3;
7747
8030
  /** Axis of rotation for the hinge (e.g., Vector3(0,1,0) for vertical axis) */
7748
8031
  axis?: Vector3;
7749
- protected createJoint(self: Rigidbody, other: Rigidbody): void;
8032
+ protected createJoint(self: Rigidbody, other: Rigidbody): any;
7750
8033
  }
7751
8034
 
7752
8035
  declare type HitPointObject = Object3D & {
@@ -7969,7 +8252,7 @@ declare const HTMLElementBase: typeof HTMLElement;
7969
8252
 
7970
8253
  export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
7971
8254
  isAnimationComponent: boolean;
7972
- addClip?(clip: AnimationClip): any;
8255
+ addClip?(clip: AnimationClip): void;
7973
8256
  };
7974
8257
 
7975
8258
  /* Excluded from this release type: IApplyPrototypeExtension */
@@ -8043,6 +8326,12 @@ export declare interface ICollider extends IComponent {
8043
8326
  * Default: undefined
8044
8327
  */
8045
8328
  filter?: number[];
8329
+ /** The density of the collider used for automatic mass calculation.
8330
+ * When the attached Rigidbody has `autoMass` enabled, the mass is computed as `density × volume`.
8331
+ * Note: Make sure to call updateProperties after having changed this property
8332
+ * Default: undefined (uses physics engine default of 1.0)
8333
+ */
8334
+ density?: number;
8046
8335
  }
8047
8336
 
8048
8337
  export declare type ICollisionContext = {
@@ -8069,7 +8358,6 @@ export declare interface IComponent extends IHasGuid {
8069
8358
  /* Excluded from this release type: __internalEnable */
8070
8359
  /* Excluded from this release type: __internalDisable */
8071
8360
  /* Excluded from this release type: __internalDestroy */
8072
- /* Excluded from this release type: resolveGuids */
8073
8361
  /** experimental, called when the script is registered for the first time, this is called even if the component is not enabled. */
8074
8362
  registering?(): any;
8075
8363
  awake(): any;
@@ -8106,6 +8394,24 @@ export declare interface IConnectionData {
8106
8394
 
8107
8395
  export declare type IContext = Context;
8108
8396
 
8397
+ /**
8398
+ * Interface for objects that hold resources and can be disposed.
8399
+ * Implement this interface on any object that needs deterministic cleanup.
8400
+ *
8401
+ * @example
8402
+ * ```ts
8403
+ * class MyResource implements IDisposable {
8404
+ * dispose() { /* release resources *\/ }
8405
+ * }
8406
+ * ```
8407
+ *
8408
+ * @category Utilities
8409
+ * @group Lifecycle
8410
+ */
8411
+ export declare interface IDisposable {
8412
+ dispose(): void;
8413
+ }
8414
+
8109
8415
  /** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
8110
8416
  declare interface IEditorModification {
8111
8417
  /**
@@ -8125,7 +8431,6 @@ export declare interface IEffectProvider {
8125
8431
 
8126
8432
  export declare interface IEventList {
8127
8433
  readonly isEventList: true;
8128
- __internalOnInstantiate(map: InstantiateContext): IEventList;
8129
8434
  }
8130
8435
 
8131
8436
  export declare interface IGameObject extends Object3D {
@@ -8981,7 +9286,7 @@ export declare function instantiate(instance: AssetReference, opts?: IInstantiat
8981
9286
  export declare function instantiate(instance: IGameObject | Object3D, opts?: IInstantiateOptions | null): IGameObject;
8982
9287
 
8983
9288
  /**
8984
- * Provides access to the instantiated object and its clone
9289
+ * Provides access to the instantiated object map (used by EventList etc.)
8985
9290
  */
8986
9291
  export declare type InstantiateContext = Readonly<InstantiateReferenceMap>;
8987
9292
 
@@ -9021,7 +9326,8 @@ export declare class InstantiateOptions implements IInstantiateOptions {
9021
9326
  cloneAssign(other: InstantiateOptions | IInstantiateOptions): void;
9022
9327
  }
9023
9328
 
9024
- declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
9329
+ /** Maps uuid/guid { original, clone } for Object3D and Component instances */
9330
+ export declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
9025
9331
 
9026
9332
  /**
9027
9333
  * An empty component that can be used to mark an object as interactable.
@@ -9092,8 +9398,10 @@ export declare interface IPhysicsEngine {
9092
9398
  postStep(): any;
9093
9399
  /** Indicates whether the physics engine is currently updating */
9094
9400
  get isUpdating(): boolean;
9095
- /** Clears all cached data (e.g., mesh data when creating scaled mesh colliders) */
9096
- clearCaches(): any;
9401
+ /** Tears down the physics world and frees all resources. The world will be re-created on next use. */
9402
+ dispose(): void;
9403
+ /** @deprecated Use {@link dispose} instead. */
9404
+ clearCaches(): void;
9097
9405
  /** Enables or disables the physics engine */
9098
9406
  enabled: boolean;
9099
9407
  /** Returns the underlying physics world object */
@@ -9323,8 +9631,9 @@ export declare interface IPhysicsEngine {
9323
9631
  * @returns The underlying physics body or null if not found
9324
9632
  */
9325
9633
  getBody(obj: ICollider | IRigidbody): null | any;
9326
- addFixedJoint(body1: IRigidbody, body2: IRigidbody): any;
9327
- addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): any;
9634
+ addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<any> | any;
9635
+ addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): Promise<any> | any;
9636
+ removeJoint(joint: any): void;
9328
9637
  /** Enable to render collider shapes */
9329
9638
  debugRenderColliders: boolean;
9330
9639
  /** Enable to visualize raycasts in the scene with gizmos */
@@ -9545,6 +9854,18 @@ export declare function isDestroyed(go: Object3D): boolean;
9545
9854
  /** True when the application runs on a local url */
9546
9855
  export declare function isDevEnvironment(): boolean;
9547
9856
 
9857
+ /**
9858
+ * Type guard to check if an object implements {@link IDisposable}.
9859
+ *
9860
+ * @example
9861
+ * ```ts
9862
+ * if (isDisposable(obj)) {
9863
+ * obj.dispose(); // safe to call
9864
+ * }
9865
+ * ```
9866
+ */
9867
+ export declare function isDisposable(value: unknown): value is IDisposable;
9868
+
9548
9869
  export declare function isDisposed(obj: object): boolean;
9549
9870
 
9550
9871
  export declare interface ISerializable {
@@ -9579,6 +9900,10 @@ export declare function isHotReloadEnabled(): boolean;
9579
9900
  /**@returns true if the element is an needle engine icon element */
9580
9901
  export declare function isIconElement(element: Node): boolean;
9581
9902
 
9903
+ export declare interface ISignalReceiver {
9904
+ readonly isSignalReceiver: true;
9905
+ }
9906
+
9582
9907
  /** @deprecated use {@link DeviceUtilities.isiOS} instead */
9583
9908
  export declare function isiOS(): boolean;
9584
9909
 
@@ -9613,6 +9938,8 @@ export declare function isResourceTrackingEnabled(): boolean;
9613
9938
  /** @deprecated use {@link DeviceUtilities.isSafari} instead */
9614
9939
  export declare function isSafari(): boolean;
9615
9940
 
9941
+ export declare function isTrackModel(obj: unknown): obj is TrackModel;
9942
+
9616
9943
  export declare function isUsingInstancing(instance: Object3D): boolean;
9617
9944
 
9618
9945
  export declare interface ITime {
@@ -9737,7 +10064,9 @@ declare abstract class Joint extends Component {
9737
10064
  connectedBody?: Rigidbody;
9738
10065
  get rigidBody(): Rigidbody | null;
9739
10066
  private _rigidBody;
10067
+ private _jointHandle;
9740
10068
  onEnable(): void;
10069
+ onDisable(): void;
9741
10070
  private create;
9742
10071
  protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
9743
10072
  }
@@ -10999,6 +11328,7 @@ export declare type Model = (GLTF | FBX | OBJ | CustomModel);
10999
11328
 
11000
11329
  declare namespace Models {
11001
11330
  export {
11331
+ isTrackModel,
11002
11332
  TimelineAssetModel,
11003
11333
  TrackType,
11004
11334
  ClipExtrapolation,
@@ -11206,11 +11536,17 @@ export declare interface NeedleEngineAttributes {
11206
11536
  'hash': string;
11207
11537
  /** Set to automatically add OrbitControls to the loaded scene. */
11208
11538
  'camera-controls': string;
11209
- /** Override the default draco decoder path location. */
11539
+ /** Override the default Draco decoder/decompressor path. Can be a URL or a local path to a directory containing the Draco decoder files.
11540
+ * @default "https://www.gstatic.com/draco/versioned/decoders/1.5.7/"
11541
+ * @example <needle-engine dracoDecoderPath="./decoders/draco/"></needle-engine>
11542
+ */
11210
11543
  'dracoDecoderPath': string;
11211
- /** Override the default draco library type. */
11544
+ /** Override the default Draco decoder type. */
11212
11545
  'dracoDecoderType': 'wasm' | 'js';
11213
- /** Override the default KTX2 transcoder/decoder path. */
11546
+ /** Override the default KTX2 transcoder/decoder path. Can be a URL or a local path to a directory containing the KTX2 transcoder files.
11547
+ * @default "https://cdn.needle.tools/static/three/0.179.1/basis2/"
11548
+ * @example <needle-engine ktx2DecoderPath="./decoders/ktx2/"></needle-engine>
11549
+ */
11214
11550
  'ktx2DecoderPath': string;
11215
11551
  /** Prevent context from being disposed when element is removed from DOM. */
11216
11552
  'keep-alive': 'true' | 'false';
@@ -12164,8 +12500,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
12164
12500
  get referenceSpace(): XRSpace | null;
12165
12501
  /** @returns the XRFrame `viewerpose` using the xr `referenceSpace` */
12166
12502
  get viewerPose(): XRViewerPose | undefined;
12167
- /** @returns `true` if any image is currently being tracked */
12168
- /** returns true if images are currently being tracked */
12503
+ /** @returns `true` if any image is currently being tracked or emulated */
12169
12504
  get isTrackingImages(): boolean;
12170
12505
  /** The currently active XR rig */
12171
12506
  get rig(): IXRRig | null;
@@ -12211,6 +12546,8 @@ export declare class NeedleXRSession implements INeedleXRSession {
12211
12546
  private readonly _xr_update_scripts;
12212
12547
  /** scripts that are in the scene but inactive (e.g. disabled parent gameObject) */
12213
12548
  private readonly _inactive_scripts;
12549
+ /** tracks scripts that have received onEnterXR — prevents spurious onLeaveXR calls */
12550
+ private readonly _scripts_in_xr;
12214
12551
  private readonly _controllerAdded;
12215
12552
  private readonly _controllerRemoved;
12216
12553
  private readonly _originalCameraWorldPosition?;
@@ -12830,7 +13167,7 @@ export declare interface NetworkEventMap {
12830
13167
  * @see {@link RoomEvents} for room lifecycle events
12831
13168
  * @see {@link isLocalNetwork} for local network detection
12832
13169
  * @link https://engine.needle.tools/docs/how-to-guides/networking/
12833
- * @summary Networking configuration
13170
+ * @summary Configures the websocket server URL for multiplayer networking
12834
13171
  * @category Networking
12835
13172
  * @group Components
12836
13173
  */
@@ -12967,7 +13304,7 @@ export declare type OBJ = {
12967
13304
  scenes: Object3D[];
12968
13305
  };
12969
13306
 
12970
- declare type ObjectCloneReference = {
13307
+ export declare type ObjectCloneReference = {
12971
13308
  readonly original: object;
12972
13309
  readonly clone: object;
12973
13310
  };
@@ -13174,6 +13511,60 @@ export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void):
13174
13511
  */
13175
13512
  export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
13176
13513
 
13514
+ /**
13515
+ * Subscribe to a DOM event on any {@link EventTarget} (window, document, HTML elements, etc.)
13516
+ * and return an {@link IDisposable} that removes the listener when disposed.
13517
+ *
13518
+ * Provides full TypeScript event type inference — the callback parameter
13519
+ * is automatically typed based on the event name (e.g. `"resize"` → `UIEvent`,
13520
+ * `"click"` → `MouseEvent`).
13521
+ *
13522
+ * Use with {@link DisposableStore.add} for automatic lifecycle cleanup in components.
13523
+ *
13524
+ * @param target The EventTarget to listen on (window, document, an element, etc.)
13525
+ * @param type The event name (e.g. `"resize"`, `"click"`, `"keydown"`)
13526
+ * @param listener The event handler callback
13527
+ * @param options Optional addEventListener options (passive, capture, once, signal)
13528
+ * @returns An {@link IDisposable} that removes the event listener when disposed
13529
+ *
13530
+ * @example Standalone usage
13531
+ * ```ts
13532
+ * import { on } from "@needle-tools/engine";
13533
+ *
13534
+ * const sub = on(window, "resize", (ev) => {
13535
+ * // ev is typed as UIEvent
13536
+ * console.log("resized", ev.target);
13537
+ * });
13538
+ *
13539
+ * // Later: clean up
13540
+ * sub.dispose();
13541
+ * ```
13542
+ *
13543
+ * @example With autoCleanup in a component
13544
+ * ```ts
13545
+ * import { Behaviour, on } from "@needle-tools/engine";
13546
+ *
13547
+ * export class MyComponent extends Behaviour {
13548
+ * onEnable() {
13549
+ * this.autoCleanup(on(window, "resize", (ev) => { /* UIEvent *\/ }));
13550
+ * this.autoCleanup(on(document, "keydown", (ev) => { /* KeyboardEvent *\/ }));
13551
+ * this.autoCleanup(on(this.context.domElement, "click", (ev) => { /* MouseEvent *\/ }));
13552
+ * }
13553
+ * // All listeners removed automatically on disable!
13554
+ * }
13555
+ * ```
13556
+ *
13557
+ * @category Utilities
13558
+ * @group Lifecycle
13559
+ */
13560
+ export declare function on<K extends keyof WindowEventMap>(target: Window, type: K, listener: (ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13561
+
13562
+ export declare function on<K extends keyof DocumentEventMap>(target: Document, type: K, listener: (ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13563
+
13564
+ export declare function on<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
13565
+
13566
+ export declare function on(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): IDisposable;
13567
+
13177
13568
  /**
13178
13569
  * Register a callback in the engine onAfterRender event
13179
13570
  * This is called every frame after the main camera has rendered
@@ -14647,13 +15038,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
14647
15038
  * The timeline asset containing tracks, clips, and markers that this director will play.
14648
15039
  * Assign a timeline asset exported from Unity or Blender to enable playback.
14649
15040
  */
14650
- playableAsset?: Models.TimelineAssetModel;
15041
+ get playableAsset(): Models.TimelineAssetModel | undefined;
15042
+ set playableAsset(value: Models.TimelineAssetModel | undefined);
15043
+ private _playableAsset?;
14651
15044
  /**
14652
15045
  * When true, the timeline starts playing automatically when the component awakens.
14653
15046
  * Set to false to control playback manually via `play()`.
14654
15047
  * @default false
14655
15048
  */
14656
- playOnAwake?: boolean;
15049
+ playOnAwake: boolean;
14657
15050
  /**
14658
15051
  * Determines how the timeline behaves when it reaches the end of its duration.
14659
15052
  * @default DirectorWrapMode.Loop
@@ -14748,6 +15141,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
14748
15141
  * @returns all marker tracks of the timeline
14749
15142
  */
14750
15143
  get markerTracks(): Tracks.MarkerTrackHandler[];
15144
+ /**
15145
+ * @returns all activation tracks of the timeline
15146
+ */
15147
+ get activationTracks(): Tracks.ActivationTrackHandler[];
15148
+ /**
15149
+ * @returns all tracks of the timeline
15150
+ */
15151
+ get tracks(): ReadonlyArray<Tracks.TrackHandler>;
14751
15152
  /**
14752
15153
  * Iterates over all markers of the timeline, optionally filtering by type
14753
15154
  *
@@ -14761,13 +15162,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
14761
15162
  *
14762
15163
  */
14763
15164
  foreachMarker<T extends Record<string, any>>(type?: string | null): Generator<(T & Models.MarkerModel)>;
14764
- private _guidsMap?;
14765
- /* Excluded from this release type: resolveGuids */
15165
+ private _needsGraphRebuild;
14766
15166
  private _isPlaying;
14767
15167
  private _internalUpdateRoutine;
14768
15168
  private _isPaused;
14769
15169
  /** internal, true during the time stop() is being processed */
14770
15170
  private _isStopping;
15171
+ /* Excluded from this release type: _isUserEvaluation */
14771
15172
  private _time;
14772
15173
  private _duration;
14773
15174
  private _weight;
@@ -14776,6 +15177,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
14776
15177
  private readonly _signalTracks;
14777
15178
  private readonly _markerTracks;
14778
15179
  private readonly _controlTracks;
15180
+ private readonly _activationTracks;
14779
15181
  private readonly _customTracks;
14780
15182
  private readonly _tracksArray;
14781
15183
  private get _allTracks();
@@ -15954,6 +16356,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
15954
16356
  private _gravity;
15955
16357
  get gravity(): Vec3;
15956
16358
  set gravity(value: Vec3);
16359
+ /** Tears down the physics world and frees all WASM resources.
16360
+ * After calling this, the world will be re-created on next use. */
16361
+ dispose(): void;
16362
+ /** @deprecated Use {@link dispose} instead. */
15957
16363
  clearCaches(): void;
15958
16364
  addBoxCollider(collider: ICollider, size: Vector3): Promise<void>;
15959
16365
  addSphereCollider(collider: ICollider): Promise<void>;
@@ -16000,7 +16406,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
16000
16406
  private getRigidbodyRelativeMatrix;
16001
16407
  private static centerConnectionPos;
16002
16408
  private static centerConnectionRot;
16003
- addFixedJoint(body1: IRigidbody, body2: IRigidbody): void;
16409
+ private _jointTempMatrix;
16410
+ addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<ImpulseJoint | null>;
16004
16411
  /** The joint prevents any relative movement between two rigid-bodies, except for relative rotations along one axis. This is typically used to simulate wheels, fans, etc. They are characterized by one local anchor as well as one local axis on each rigid-body. */
16005
16412
  addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: {
16006
16413
  x: number;
@@ -16010,8 +16417,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
16010
16417
  x: number;
16011
16418
  y: number;
16012
16419
  z: number;
16013
- }): void;
16420
+ }): Promise<ImpulseJoint | null>;
16421
+ removeJoint(joint: ImpulseJoint): void;
16422
+ /** Compute the relative transform from body1's local space to body2's local space (W2⁻¹ * W1), ignoring scale. */
16014
16423
  private calculateJointRelativeMatrices;
16424
+ private normalizeMatrixColumns;
16015
16425
  }
16016
16426
 
16017
16427
  /**
@@ -16814,10 +17224,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
16814
17224
  */
16815
17225
  export declare class Rigidbody extends Component implements IRigidbody {
16816
17226
  get isRigidbody(): boolean;
16817
- /** When true the mass will be automatically calculated by the attached colliders */
17227
+ /** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
17228
+ * Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
17229
+ * Disable to set mass explicitly via the `mass` property.
17230
+ */
16818
17231
  autoMass: boolean;
16819
- /** By default the mass will be automatically calculated (see `autoMass`) by the physics engine using the collider sizes
16820
- * To set the mass manually you can either set the `mass` value or set `autoMass` to `false`
17232
+ /** The mass of the rigidbody in kg (when `autoMass` is disabled).
17233
+ * When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
17234
+ * Setting this property automatically disables `autoMass`.
17235
+ *
17236
+ * **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
17237
+ * naturally with collider size, while explicit mass stays fixed regardless of shape changes.
16821
17238
  */
16822
17239
  set mass(value: number);
16823
17240
  get mass(): number;
@@ -16900,7 +17317,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
16900
17317
  onEnable(): void;
16901
17318
  onDisable(): void;
16902
17319
  onDestroy(): void;
16903
- onValidate(): void;
17320
+ onValidate(property?: string): void;
17321
+ private static _didWarnAutoMass;
16904
17322
  beforePhysics(): Generator<undefined, void, unknown>;
16905
17323
  /** Teleport the rigidbody to a new position in the world.
16906
17324
  * Will reset forces before setting the object world position
@@ -18556,6 +18974,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
18556
18974
  asset: string;
18557
18975
  }
18558
18976
 
18977
+ /**
18978
+ * Options for a signal marker in the timeline builder
18979
+ */
18980
+ export declare type SignalMarkerOptions = {
18981
+ /** Whether the signal should fire if the playback starts past its time (default: false) */
18982
+ retroActive?: boolean;
18983
+ /** Whether the signal should only fire once (default: false) */
18984
+ emitOnce?: boolean;
18985
+ };
18986
+
18559
18987
  /** SignalReceiver is a component that listens for signals and invokes a reaction when a signal is received.
18560
18988
  * Signals can be added to a signal track on a {@link PlayableDirector}
18561
18989
  *
@@ -18563,7 +18991,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
18563
18991
  * @category Animation and Sequencing
18564
18992
  * @group Components
18565
18993
  */
18566
- export declare class SignalReceiver extends Component {
18994
+ export declare class SignalReceiver extends Component implements ISignalReceiver {
18995
+ readonly isSignalReceiver = true;
18567
18996
  private static receivers;
18568
18997
  static invoke(guid: string): void;
18569
18998
  events?: SignalReceiverEvent[];
@@ -18586,6 +19015,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
18586
19015
  models: Models.SignalMarkerModel[];
18587
19016
  didTrigger: boolean[];
18588
19017
  receivers: Array<SignalReceiver | null>;
19018
+ private _lastTime;
19019
+ onEnable(): void;
19020
+ onMuteChanged(): void;
18589
19021
  evaluate(time: number): void;
18590
19022
  }
18591
19023
 
@@ -19085,10 +19517,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
19085
19517
  * Removes scale change monitoring when the collider is disabled.
19086
19518
  */
19087
19519
  onDisable(): void;
19088
- /**
19089
- * Updates collider properties when validated in the editor or inspector.
19090
- */
19091
- onValidate(): void;
19092
19520
  }
19093
19521
 
19094
19522
  export declare class SphereIntersection implements Intersection {
@@ -20408,6 +20836,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20408
20836
  set font(val: string | null);
20409
20837
  get font(): string | null;
20410
20838
  private _font;
20839
+ private _assignedAtRuntime;
20411
20840
  /**
20412
20841
  * Whether to support basic rich text tags in the `text` property. Supported tags include `<b>`, `<i>`, and `<color=hex>`. For example: `Hello <b>World</b>` or `Score: <color=#ff0000>100</color>`
20413
20842
  * @default false
@@ -20672,6 +21101,166 @@ export declare class OrbitControls extends Component implements ICameraControlle
20672
21101
  tracks: TrackModel[];
20673
21102
  };
20674
21103
 
21104
+ /**
21105
+ * A fluent builder for creating timeline assets ({@link TimelineAssetModel}) from code.
21106
+ *
21107
+ * Use {@link TimelineBuilder.create} to start building a timeline.
21108
+ *
21109
+ * @example Using build() for timelines without signal callbacks
21110
+ * ```ts
21111
+ * const timeline = TimelineBuilder.create("MySequence")
21112
+ * .animationTrack("Character", animator)
21113
+ * .clip(walkClip, { duration: 2, easeIn: 0.3 })
21114
+ * .clip(runClip, { duration: 3, easeIn: 0.5, easeOut: 0.5 })
21115
+ * .activationTrack("FX", particleObject)
21116
+ * .clip({ start: 1, duration: 2 })
21117
+ * .audioTrack("Music", audioSource)
21118
+ * .clip("music.mp3", { start: 0, duration: 5, volume: 0.8 })
21119
+ * .build();
21120
+ *
21121
+ * director.playableAsset = timeline;
21122
+ * director.play();
21123
+ * ```
21124
+ *
21125
+ * @example Using install() with signal callbacks
21126
+ * ```ts
21127
+ * TimelineBuilder.create("WithSignals")
21128
+ * .animationTrack("Character", animator)
21129
+ * .clip(walkClip, { duration: 2 })
21130
+ * .signalTrack("Events")
21131
+ * .signal(1.0, () => console.log("1 second!"))
21132
+ * .signal(2.0, () => spawnParticles())
21133
+ * .install(director);
21134
+ *
21135
+ * director.play();
21136
+ * ```
21137
+ *
21138
+ * @category Animation and Sequencing
21139
+ * @group Utilities
21140
+ */
21141
+ export declare class TimelineBuilder {
21142
+ private _name;
21143
+ private _tracks;
21144
+ private _currentTrack;
21145
+ private _pendingSignals;
21146
+ private _idProvider;
21147
+ private constructor();
21148
+ /**
21149
+ * Creates a new TimelineBuilder instance.
21150
+ * @param name - Name for the timeline asset
21151
+ * @param seed - Optional numeric seed for deterministic guid generation. Defaults to `Date.now()`.
21152
+ */
21153
+ static create(name?: string, seed?: number): TimelineBuilder;
21154
+ /**
21155
+ * Adds an animation track. Subsequent `.clip()` calls add animation clips to this track.
21156
+ * @param name - Display name for the track
21157
+ * @param binding - The Animator or Object3D to animate
21158
+ */
21159
+ animationTrack(name: string, binding?: Animator | Object3D | null): this;
21160
+ /**
21161
+ * Adds an audio track. Subsequent `.clip()` calls add audio clips to this track.
21162
+ * @param name - Display name for the track
21163
+ * @param binding - The AudioSource to play audio on (optional)
21164
+ * @param volume - Track volume multiplier (default: 1)
21165
+ */
21166
+ audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): this;
21167
+ /**
21168
+ * Adds an activation track. Subsequent `.clip()` calls define when the bound object is active.
21169
+ * @param name - Display name for the track
21170
+ * @param binding - The Object3D to show/hide
21171
+ */
21172
+ activationTrack(name: string, binding?: Object3D | null): this;
21173
+ /**
21174
+ * Adds a control track. Subsequent `.clip()` calls control nested timelines or objects.
21175
+ * @param name - Display name for the track
21176
+ */
21177
+ controlTrack(name: string): this;
21178
+ /**
21179
+ * Adds a signal track. Use `.signal()` or `.marker()` to add signal markers.
21180
+ * @param name - Display name for the track
21181
+ * @param binding - The SignalReceiver component (optional — if using `.signal()` with callbacks, one is created automatically by {@link install})
21182
+ */
21183
+ signalTrack(name: string, binding?: SignalReceiver | Object3D | null): this;
21184
+ /**
21185
+ * Adds a marker track. Use `.marker()` to add markers.
21186
+ * @param name - Display name for the track
21187
+ */
21188
+ markerTrack(name: string): this;
21189
+ /**
21190
+ * Adds a clip to the current track. The clip type must match the track type.
21191
+ *
21192
+ * - On an **animation track**: pass an `AnimationClip` and optional {@link AnimationClipOptions}
21193
+ * - On an **audio track**: pass a clip URL (string) and {@link AudioClipOptions}
21194
+ * - On an **activation track**: pass {@link ActivationClipOptions}
21195
+ * - On a **control track**: pass an Object3D and {@link ControlClipOptions}
21196
+ */
21197
+ clip(asset: AnimationClip, options?: AnimationClipOptions): this;
21198
+ clip(url: string, options: AudioClipOptions): this;
21199
+ clip(options: ActivationClipOptions): this;
21200
+ clip(sourceObject: Object3D, options: ControlClipOptions): this;
21201
+ /**
21202
+ * Adds a signal marker to the current signal or marker track.
21203
+ * @param time - Time in seconds when the signal fires
21204
+ * @param asset - The signal asset identifier (guid string)
21205
+ * @param options - Optional marker configuration
21206
+ */
21207
+ marker(time: number, asset: string, options?: SignalMarkerOptions): this;
21208
+ /**
21209
+ * Adds a signal with a callback to the current signal track.
21210
+ * This is a convenience method that automatically generates a signal asset guid,
21211
+ * adds the marker, and registers the callback so that {@link install} can wire up
21212
+ * the `SignalReceiver` on the director's GameObject.
21213
+ *
21214
+ * @param time - Time in seconds when the signal fires
21215
+ * @param callback - The function to invoke when the signal fires
21216
+ * @param options - Optional marker configuration
21217
+ *
21218
+ * @example
21219
+ * ```ts
21220
+ * const timeline = TimelineBuilder.create("Sequence")
21221
+ * .signalTrack("Events")
21222
+ * .signal(1.0, () => console.log("1 second reached!"))
21223
+ * .signal(3.5, () => console.log("halfway!"), { emitOnce: true })
21224
+ * .install(director);
21225
+ * ```
21226
+ */
21227
+ signal(time: number, callback: Function, options?: SignalMarkerOptions): this;
21228
+ /**
21229
+ * Mutes the current track so it is skipped during playback.
21230
+ */
21231
+ muted(muted?: boolean): this;
21232
+ /**
21233
+ * Builds and returns the {@link TimelineAssetModel}.
21234
+ * Assign the result to `PlayableDirector.playableAsset` to play it.
21235
+ *
21236
+ * If you used `.signal()` with callbacks, use {@link install} instead — it calls `build()`
21237
+ * internally and also wires up the SignalReceiver on the director's GameObject.
21238
+ */
21239
+ build(): TimelineAssetModel;
21240
+ /**
21241
+ * Builds the timeline asset, assigns it to the director, and wires up any
21242
+ * `.signal()` callbacks by creating/configuring a {@link SignalReceiver} on the
21243
+ * director's GameObject.
21244
+ *
21245
+ * @param director - The PlayableDirector to install the timeline on
21246
+ * @returns The built TimelineAssetModel (also assigned to `director.playableAsset`)
21247
+ *
21248
+ * @example
21249
+ * ```ts
21250
+ * TimelineBuilder.create("MyTimeline")
21251
+ * .animationTrack("Anim", animator)
21252
+ * .clip(walkClip, { duration: 2 })
21253
+ * .signalTrack("Events")
21254
+ * .signal(1.0, () => console.log("signal fired!"))
21255
+ * .install(director);
21256
+ *
21257
+ * director.play();
21258
+ * ```
21259
+ */
21260
+ install(director: PlayableDirector): TimelineAssetModel;
21261
+ private pushTrack;
21262
+ }
21263
+
20675
21264
  declare type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
20676
21265
 
20677
21266
  /**
@@ -20753,6 +21342,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20753
21342
  AudioTrackHandler,
20754
21343
  MarkerTrackHandler,
20755
21344
  SignalTrackHandler,
21345
+ ActivationTrackHandler,
20756
21346
  ControlTrackHandler
20757
21347
  }
20758
21348
  }
@@ -23541,13 +24131,6 @@ declare module 'three' {
23541
24131
  }
23542
24132
 
23543
24133
 
23544
- declare module 'three' {
23545
- interface Vector3 {
23546
- slerp(end: Vector3, t: number): Vector3;
23547
- }
23548
- }
23549
-
23550
-
23551
24134
  declare module 'three' {
23552
24135
  interface Object3D {
23553
24136
  get guid(): string | undefined;
@@ -23686,3 +24269,10 @@ declare module 'three' {
23686
24269
  contains(object: Object3D | null | undefined): boolean;
23687
24270
  }
23688
24271
  }
24272
+
24273
+
24274
+ declare module 'three' {
24275
+ interface Vector3 {
24276
+ slerp(end: Vector3, t: number): Vector3;
24277
+ }
24278
+ }