@needle-tools/engine 4.13.0 → 4.13.1-beta

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 (410) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/README.md +37 -0
  3. package/components.needle.json +1 -1
  4. package/custom-elements.json +138 -4
  5. package/dist/{needle-engine.bundle-CxaKFQVS.min.js → needle-engine.bundle-6774fXoY.min.js} +107 -107
  6. package/dist/{needle-engine.bundle-Dl3TFYyv.js → needle-engine.bundle-CGtsEhyJ.js} +2346 -1844
  7. package/dist/{needle-engine.bundle-J4k4znv8.umd.cjs → needle-engine.bundle-fbFZTOKP.umd.cjs} +108 -108
  8. package/dist/needle-engine.d.ts +3769 -397
  9. package/dist/needle-engine.js +2 -2
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/lib/engine/engine_context.d.ts +16 -0
  13. package/lib/engine/engine_context.js +16 -0
  14. package/lib/engine/engine_context.js.map +1 -1
  15. package/lib/engine/engine_gameobject.d.ts +72 -0
  16. package/lib/engine/engine_gameobject.js +38 -0
  17. package/lib/engine/engine_gameobject.js.map +1 -1
  18. package/lib/engine/engine_input.d.ts +80 -4
  19. package/lib/engine/engine_input.js +78 -2
  20. package/lib/engine/engine_input.js.map +1 -1
  21. package/lib/engine/engine_math.d.ts +81 -2
  22. package/lib/engine/engine_math.js +68 -2
  23. package/lib/engine/engine_math.js.map +1 -1
  24. package/lib/engine/engine_networking.d.ts +181 -14
  25. package/lib/engine/engine_networking.js +181 -14
  26. package/lib/engine/engine_networking.js.map +1 -1
  27. package/lib/engine/engine_networking_auto.d.ts +35 -8
  28. package/lib/engine/engine_networking_auto.js +35 -8
  29. package/lib/engine/engine_networking_auto.js.map +1 -1
  30. package/lib/engine/engine_physics.d.ts +35 -1
  31. package/lib/engine/engine_physics.js +35 -1
  32. package/lib/engine/engine_physics.js.map +1 -1
  33. package/lib/engine/engine_physics_rapier.d.ts +76 -0
  34. package/lib/engine/engine_physics_rapier.js +76 -0
  35. package/lib/engine/engine_physics_rapier.js.map +1 -1
  36. package/lib/engine/engine_serialization_decorator.d.ts +28 -2
  37. package/lib/engine/engine_serialization_decorator.js +28 -2
  38. package/lib/engine/engine_serialization_decorator.js.map +1 -1
  39. package/lib/engine/engine_time.d.ts +23 -3
  40. package/lib/engine/engine_time.js +23 -3
  41. package/lib/engine/engine_time.js.map +1 -1
  42. package/lib/engine/engine_util_decorator.d.ts +31 -1
  43. package/lib/engine/engine_util_decorator.js +31 -1
  44. package/lib/engine/engine_util_decorator.js.map +1 -1
  45. package/lib/engine/engine_utils.d.ts +21 -5
  46. package/lib/engine/engine_utils.js +21 -5
  47. package/lib/engine/engine_utils.js.map +1 -1
  48. package/lib/engine/extensions/NEEDLE_materialx.d.ts +2 -2
  49. package/lib/engine/extensions/NEEDLE_materialx.js +2 -2
  50. package/lib/engine/extensions/NEEDLE_materialx.js.map +1 -1
  51. package/lib/engine/extensions/index.d.ts +1 -1
  52. package/lib/engine/extensions/index.js +1 -1
  53. package/lib/engine/extensions/index.js.map +1 -1
  54. package/lib/engine-components/AlignmentConstraint.d.ts +23 -3
  55. package/lib/engine-components/AlignmentConstraint.js +23 -3
  56. package/lib/engine-components/AlignmentConstraint.js.map +1 -1
  57. package/lib/engine-components/Animation.d.ts +42 -0
  58. package/lib/engine-components/Animation.js +36 -0
  59. package/lib/engine-components/Animation.js.map +1 -1
  60. package/lib/engine-components/Animator.d.ts +37 -4
  61. package/lib/engine-components/Animator.js +37 -4
  62. package/lib/engine-components/Animator.js.map +1 -1
  63. package/lib/engine-components/AudioListener.d.ts +1 -1
  64. package/lib/engine-components/AudioListener.js +1 -1
  65. package/lib/engine-components/AudioSource.d.ts +32 -10
  66. package/lib/engine-components/AudioSource.js +32 -10
  67. package/lib/engine-components/AudioSource.js.map +1 -1
  68. package/lib/engine-components/AxesHelper.d.ts +22 -3
  69. package/lib/engine-components/AxesHelper.js +22 -3
  70. package/lib/engine-components/AxesHelper.js.map +1 -1
  71. package/lib/engine-components/BasicIKConstraint.d.ts +27 -4
  72. package/lib/engine-components/BasicIKConstraint.js +27 -4
  73. package/lib/engine-components/BasicIKConstraint.js.map +1 -1
  74. package/lib/engine-components/Camera.d.ts +32 -2
  75. package/lib/engine-components/Camera.js +32 -2
  76. package/lib/engine-components/Camera.js.map +1 -1
  77. package/lib/engine-components/CharacterController.d.ts +68 -4
  78. package/lib/engine-components/CharacterController.js +68 -4
  79. package/lib/engine-components/CharacterController.js.map +1 -1
  80. package/lib/engine-components/Collider.d.ts +69 -12
  81. package/lib/engine-components/Collider.js +69 -12
  82. package/lib/engine-components/Collider.js.map +1 -1
  83. package/lib/engine-components/ContactShadows.d.ts +26 -6
  84. package/lib/engine-components/ContactShadows.js +31 -8
  85. package/lib/engine-components/ContactShadows.js.map +1 -1
  86. package/lib/engine-components/DeleteBox.d.ts +43 -2
  87. package/lib/engine-components/DeleteBox.js +43 -2
  88. package/lib/engine-components/DeleteBox.js.map +1 -1
  89. package/lib/engine-components/DeviceFlag.d.ts +21 -2
  90. package/lib/engine-components/DeviceFlag.js +21 -2
  91. package/lib/engine-components/DeviceFlag.js.map +1 -1
  92. package/lib/engine-components/DragControls.d.ts +32 -2
  93. package/lib/engine-components/DragControls.js +32 -2
  94. package/lib/engine-components/DragControls.js.map +1 -1
  95. package/lib/engine-components/DropListener.d.ts +33 -21
  96. package/lib/engine-components/DropListener.js +33 -21
  97. package/lib/engine-components/DropListener.js.map +1 -1
  98. package/lib/engine-components/Duplicatable.d.ts +36 -5
  99. package/lib/engine-components/Duplicatable.js +36 -5
  100. package/lib/engine-components/Duplicatable.js.map +1 -1
  101. package/lib/engine-components/EventList.d.ts +38 -10
  102. package/lib/engine-components/EventList.js +38 -10
  103. package/lib/engine-components/EventList.js.map +1 -1
  104. package/lib/engine-components/EventTrigger.d.ts +1 -1
  105. package/lib/engine-components/EventTrigger.js +1 -1
  106. package/lib/engine-components/Fog.d.ts +23 -1
  107. package/lib/engine-components/Fog.js +23 -1
  108. package/lib/engine-components/Fog.js.map +1 -1
  109. package/lib/engine-components/GridHelper.d.ts +18 -2
  110. package/lib/engine-components/GridHelper.js +18 -2
  111. package/lib/engine-components/GridHelper.js.map +1 -1
  112. package/lib/engine-components/GroundProjection.d.ts +24 -2
  113. package/lib/engine-components/GroundProjection.js +24 -2
  114. package/lib/engine-components/GroundProjection.js.map +1 -1
  115. package/lib/engine-components/Interactable.d.ts +17 -2
  116. package/lib/engine-components/Interactable.js +17 -2
  117. package/lib/engine-components/Interactable.js.map +1 -1
  118. package/lib/engine-components/Joints.d.ts +50 -7
  119. package/lib/engine-components/Joints.js +50 -7
  120. package/lib/engine-components/Joints.js.map +1 -1
  121. package/lib/engine-components/LODGroup.d.ts +36 -14
  122. package/lib/engine-components/LODGroup.js +43 -11
  123. package/lib/engine-components/LODGroup.js.map +1 -1
  124. package/lib/engine-components/Light.d.ts +30 -5
  125. package/lib/engine-components/Light.js +30 -5
  126. package/lib/engine-components/Light.js.map +1 -1
  127. package/lib/engine-components/LookAtConstraint.d.ts +22 -7
  128. package/lib/engine-components/LookAtConstraint.js +22 -7
  129. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  130. package/lib/engine-components/NeedleMenu.d.ts +27 -5
  131. package/lib/engine-components/NeedleMenu.js +27 -5
  132. package/lib/engine-components/NeedleMenu.js.map +1 -1
  133. package/lib/engine-components/NestedGltf.d.ts +39 -4
  134. package/lib/engine-components/NestedGltf.js +42 -4
  135. package/lib/engine-components/NestedGltf.js.map +1 -1
  136. package/lib/engine-components/OffsetConstraint.d.ts +27 -3
  137. package/lib/engine-components/OffsetConstraint.js +27 -3
  138. package/lib/engine-components/OffsetConstraint.js.map +1 -1
  139. package/lib/engine-components/OrbitControls.d.ts +41 -3
  140. package/lib/engine-components/OrbitControls.js +41 -3
  141. package/lib/engine-components/OrbitControls.js.map +1 -1
  142. package/lib/engine-components/PlayerColor.d.ts +1 -1
  143. package/lib/engine-components/PlayerColor.js +1 -1
  144. package/lib/engine-components/ReflectionProbe.d.ts +17 -2
  145. package/lib/engine-components/ReflectionProbe.js +17 -3
  146. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  147. package/lib/engine-components/Renderer.d.ts +34 -0
  148. package/lib/engine-components/Renderer.js +35 -2
  149. package/lib/engine-components/Renderer.js.map +1 -1
  150. package/lib/engine-components/SceneSwitcher.d.ts +11 -0
  151. package/lib/engine-components/SceneSwitcher.js +11 -0
  152. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  153. package/lib/engine-components/ScreenCapture.d.ts +38 -6
  154. package/lib/engine-components/ScreenCapture.js +38 -6
  155. package/lib/engine-components/ScreenCapture.js.map +1 -1
  156. package/lib/engine-components/Skybox.d.ts +1 -1
  157. package/lib/engine-components/Skybox.js +1 -1
  158. package/lib/engine-components/SmoothFollow.d.ts +66 -7
  159. package/lib/engine-components/SmoothFollow.js +66 -7
  160. package/lib/engine-components/SmoothFollow.js.map +1 -1
  161. package/lib/engine-components/SpatialTrigger.d.ts +48 -1
  162. package/lib/engine-components/SpatialTrigger.js +48 -1
  163. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  164. package/lib/engine-components/SpectatorCamera.d.ts +21 -3
  165. package/lib/engine-components/SpectatorCamera.js +21 -3
  166. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  167. package/lib/engine-components/SyncedRoom.d.ts +7 -1
  168. package/lib/engine-components/SyncedRoom.js +7 -1
  169. package/lib/engine-components/SyncedRoom.js.map +1 -1
  170. package/lib/engine-components/SyncedTransform.d.ts +55 -6
  171. package/lib/engine-components/SyncedTransform.js +55 -6
  172. package/lib/engine-components/SyncedTransform.js.map +1 -1
  173. package/lib/engine-components/TransformGizmo.d.ts +30 -3
  174. package/lib/engine-components/TransformGizmo.js +30 -3
  175. package/lib/engine-components/TransformGizmo.js.map +1 -1
  176. package/lib/engine-components/VideoPlayer.d.ts +33 -6
  177. package/lib/engine-components/VideoPlayer.js +45 -6
  178. package/lib/engine-components/VideoPlayer.js.map +1 -1
  179. package/lib/engine-components/Voip.d.ts +33 -2
  180. package/lib/engine-components/Voip.js +33 -2
  181. package/lib/engine-components/Voip.js.map +1 -1
  182. package/lib/engine-components/export/usdz/USDZExporter.d.ts +47 -13
  183. package/lib/engine-components/export/usdz/USDZExporter.js +47 -13
  184. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  185. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +82 -3
  186. package/lib/engine-components/particlesystem/ParticleSystem.js +82 -3
  187. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  188. package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +1 -0
  189. package/lib/engine-components/postprocessing/Effects/Antialiasing.js +1 -0
  190. package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
  191. package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
  192. package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -1
  193. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +1 -1
  194. package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +1 -1
  195. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +1 -1
  196. package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +1 -1
  197. package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +1 -1
  198. package/lib/engine-components/postprocessing/Effects/DepthOfField.js +1 -1
  199. package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
  200. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
  201. package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
  202. package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +1 -1
  203. package/lib/engine-components/postprocessing/Effects/Pixelation.js +1 -1
  204. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +1 -1
  205. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +1 -1
  206. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +1 -1
  207. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +1 -1
  208. package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +1 -1
  209. package/lib/engine-components/postprocessing/Effects/Sharpening.js +1 -1
  210. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +1 -1
  211. package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +1 -1
  212. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +1 -1
  213. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +1 -1
  214. package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +1 -1
  215. package/lib/engine-components/postprocessing/Effects/Vignette.js +1 -1
  216. package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -1
  217. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  218. package/lib/engine-components/postprocessing/Volume.d.ts +1 -1
  219. package/lib/engine-components/postprocessing/Volume.js +1 -1
  220. package/lib/engine-components/splines/Spline.d.ts +409 -12
  221. package/lib/engine-components/splines/Spline.js +409 -12
  222. package/lib/engine-components/splines/Spline.js.map +1 -1
  223. package/lib/engine-components/splines/SplineUtils.d.ts +1 -0
  224. package/lib/engine-components/splines/SplineUtils.js +1 -0
  225. package/lib/engine-components/splines/SplineUtils.js.map +1 -1
  226. package/lib/engine-components/splines/SplineWalker.d.ts +3 -1
  227. package/lib/engine-components/splines/SplineWalker.js +3 -1
  228. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  229. package/lib/engine-components/timeline/PlayableDirector.d.ts +99 -14
  230. package/lib/engine-components/timeline/PlayableDirector.js +91 -25
  231. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  232. package/lib/engine-components/ui/Button.d.ts +29 -3
  233. package/lib/engine-components/ui/Button.js +29 -3
  234. package/lib/engine-components/ui/Button.js.map +1 -1
  235. package/lib/engine-components/ui/Canvas.d.ts +29 -4
  236. package/lib/engine-components/ui/Canvas.js +29 -4
  237. package/lib/engine-components/ui/Canvas.js.map +1 -1
  238. package/lib/engine-components/ui/CanvasGroup.d.ts +1 -1
  239. package/lib/engine-components/ui/CanvasGroup.js +1 -1
  240. package/lib/engine-components/ui/EventSystem.d.ts +1 -1
  241. package/lib/engine-components/ui/EventSystem.js +1 -1
  242. package/lib/engine-components/ui/Graphic.d.ts +1 -0
  243. package/lib/engine-components/ui/Graphic.js +1 -0
  244. package/lib/engine-components/ui/Graphic.js.map +1 -1
  245. package/lib/engine-components/ui/Image.d.ts +22 -3
  246. package/lib/engine-components/ui/Image.js +22 -3
  247. package/lib/engine-components/ui/Image.js.map +1 -1
  248. package/lib/engine-components/ui/InputField.d.ts +1 -1
  249. package/lib/engine-components/ui/InputField.js +1 -1
  250. package/lib/engine-components/ui/Layout.d.ts +3 -0
  251. package/lib/engine-components/ui/Layout.js +3 -0
  252. package/lib/engine-components/ui/Layout.js.map +1 -1
  253. package/lib/engine-components/ui/Outline.d.ts +1 -1
  254. package/lib/engine-components/ui/Outline.js +1 -1
  255. package/lib/engine-components/ui/PointerEvents.d.ts +1 -1
  256. package/lib/engine-components/ui/PointerEvents.js +1 -1
  257. package/lib/engine-components/ui/Raycaster.d.ts +55 -6
  258. package/lib/engine-components/ui/Raycaster.js +55 -6
  259. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  260. package/lib/engine-components/ui/RectTransform.d.ts +1 -1
  261. package/lib/engine-components/ui/RectTransform.js +1 -1
  262. package/lib/engine-components/ui/SpatialHtml.d.ts +1 -1
  263. package/lib/engine-components/ui/SpatialHtml.js +1 -1
  264. package/lib/engine-components/ui/Text.d.ts +23 -1
  265. package/lib/engine-components/ui/Text.js +23 -1
  266. package/lib/engine-components/ui/Text.js.map +1 -1
  267. package/lib/engine-components/utils/LookAt.d.ts +1 -1
  268. package/lib/engine-components/utils/LookAt.js +1 -1
  269. package/lib/engine-components/utils/OpenURL.d.ts +1 -1
  270. package/lib/engine-components/utils/OpenURL.js +1 -1
  271. package/lib/engine-components/web/Clickthrough.d.ts +116 -7
  272. package/lib/engine-components/web/Clickthrough.js +116 -7
  273. package/lib/engine-components/web/Clickthrough.js.map +1 -1
  274. package/lib/engine-components/web/CursorFollow.d.ts +171 -7
  275. package/lib/engine-components/web/CursorFollow.js +171 -7
  276. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  277. package/lib/engine-components/web/HoverAnimation.d.ts +140 -11
  278. package/lib/engine-components/web/HoverAnimation.js +140 -11
  279. package/lib/engine-components/web/HoverAnimation.js.map +1 -1
  280. package/lib/engine-components/web/ScrollFollow.d.ts +4 -1
  281. package/lib/engine-components/web/ScrollFollow.js +4 -1
  282. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  283. package/lib/engine-components/web/ViewBox.d.ts +116 -16
  284. package/lib/engine-components/web/ViewBox.js +110 -16
  285. package/lib/engine-components/web/ViewBox.js.map +1 -1
  286. package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -2
  287. package/lib/engine-components/webxr/TeleportTarget.js +21 -2
  288. package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
  289. package/lib/engine-components/webxr/WebXR.d.ts +10 -2
  290. package/lib/engine-components/webxr/WebXR.js +10 -2
  291. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  292. package/lib/engine-components/webxr/WebXRAvatar.d.ts +39 -2
  293. package/lib/engine-components/webxr/WebXRAvatar.js +35 -3
  294. package/lib/engine-components/webxr/WebXRAvatar.js.map +1 -1
  295. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +266 -30
  296. package/lib/engine-components/webxr/WebXRImageTracking.js +266 -30
  297. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  298. package/lib/engine-components/webxr/WebXRPlaneTracking.d.ts +1 -1
  299. package/lib/engine-components/webxr/WebXRPlaneTracking.js +1 -1
  300. package/lib/engine-components/webxr/XRFlag.d.ts +29 -2
  301. package/lib/engine-components/webxr/XRFlag.js +29 -2
  302. package/lib/engine-components/webxr/XRFlag.js.map +1 -1
  303. package/package.json +1 -1
  304. package/plugins/vite/custom-element-data.js +128 -19
  305. package/src/engine/engine_context.ts +16 -0
  306. package/src/engine/engine_gameobject.ts +73 -0
  307. package/src/engine/engine_input.ts +83 -7
  308. package/src/engine/engine_math.ts +81 -2
  309. package/src/engine/engine_networking.ts +186 -17
  310. package/src/engine/engine_networking_auto.ts +36 -9
  311. package/src/engine/engine_physics.ts +37 -1
  312. package/src/engine/engine_physics_rapier.ts +77 -0
  313. package/src/engine/engine_serialization_decorator.ts +28 -2
  314. package/src/engine/engine_time.ts +23 -3
  315. package/src/engine/engine_util_decorator.ts +31 -1
  316. package/src/engine/engine_utils.ts +21 -5
  317. package/src/engine/extensions/NEEDLE_materialx.ts +5 -4
  318. package/src/engine/extensions/index.ts +2 -2
  319. package/src/engine-components/AlignmentConstraint.ts +24 -4
  320. package/src/engine-components/Animation.ts +44 -2
  321. package/src/engine-components/Animator.ts +40 -7
  322. package/src/engine-components/AudioListener.ts +1 -1
  323. package/src/engine-components/AudioSource.ts +37 -15
  324. package/src/engine-components/AxesHelper.ts +23 -4
  325. package/src/engine-components/BasicIKConstraint.ts +28 -5
  326. package/src/engine-components/Camera.ts +33 -3
  327. package/src/engine-components/CharacterController.ts +74 -7
  328. package/src/engine-components/Collider.ts +78 -21
  329. package/src/engine-components/ContactShadows.ts +36 -11
  330. package/src/engine-components/DeleteBox.ts +43 -2
  331. package/src/engine-components/DeviceFlag.ts +22 -3
  332. package/src/engine-components/DragControls.ts +32 -2
  333. package/src/engine-components/DropListener.ts +41 -29
  334. package/src/engine-components/Duplicatable.ts +37 -6
  335. package/src/engine-components/EventList.ts +41 -13
  336. package/src/engine-components/EventTrigger.ts +1 -1
  337. package/src/engine-components/Fog.ts +23 -1
  338. package/src/engine-components/GridHelper.ts +18 -2
  339. package/src/engine-components/GroundProjection.ts +25 -3
  340. package/src/engine-components/Interactable.ts +17 -2
  341. package/src/engine-components/Joints.ts +51 -8
  342. package/src/engine-components/LODGroup.ts +45 -11
  343. package/src/engine-components/Light.ts +35 -13
  344. package/src/engine-components/LookAtConstraint.ts +26 -8
  345. package/src/engine-components/NeedleMenu.ts +29 -7
  346. package/src/engine-components/NestedGltf.ts +40 -4
  347. package/src/engine-components/OffsetConstraint.ts +27 -3
  348. package/src/engine-components/OrbitControls.ts +41 -3
  349. package/src/engine-components/PlayerColor.ts +1 -1
  350. package/src/engine-components/ReflectionProbe.ts +19 -5
  351. package/src/engine-components/Renderer.ts +34 -1
  352. package/src/engine-components/SceneSwitcher.ts +11 -0
  353. package/src/engine-components/ScreenCapture.ts +41 -9
  354. package/src/engine-components/Skybox.ts +1 -1
  355. package/src/engine-components/SmoothFollow.ts +68 -7
  356. package/src/engine-components/SpatialTrigger.ts +51 -4
  357. package/src/engine-components/SpectatorCamera.ts +23 -5
  358. package/src/engine-components/SyncedRoom.ts +8 -2
  359. package/src/engine-components/SyncedTransform.ts +59 -10
  360. package/src/engine-components/TransformGizmo.ts +31 -4
  361. package/src/engine-components/VideoPlayer.ts +48 -6
  362. package/src/engine-components/Voip.ts +33 -2
  363. package/src/engine-components/export/usdz/USDZExporter.ts +47 -13
  364. package/src/engine-components/particlesystem/ParticleSystem.ts +84 -5
  365. package/src/engine-components/postprocessing/Effects/Antialiasing.ts +1 -0
  366. package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
  367. package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
  368. package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
  369. package/src/engine-components/postprocessing/Effects/DepthOfField.ts +1 -1
  370. package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
  371. package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
  372. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
  373. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
  374. package/src/engine-components/postprocessing/Effects/Sharpening.ts +1 -1
  375. package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +1 -1
  376. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
  377. package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
  378. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  379. package/src/engine-components/postprocessing/Volume.ts +1 -1
  380. package/src/engine-components/splines/Spline.ts +412 -14
  381. package/src/engine-components/splines/SplineUtils.ts +1 -0
  382. package/src/engine-components/splines/SplineWalker.ts +4 -2
  383. package/src/engine-components/timeline/PlayableDirector.ts +104 -27
  384. package/src/engine-components/ui/Button.ts +29 -3
  385. package/src/engine-components/ui/Canvas.ts +29 -4
  386. package/src/engine-components/ui/CanvasGroup.ts +2 -2
  387. package/src/engine-components/ui/EventSystem.ts +1 -1
  388. package/src/engine-components/ui/Graphic.ts +1 -0
  389. package/src/engine-components/ui/Image.ts +22 -3
  390. package/src/engine-components/ui/InputField.ts +2 -2
  391. package/src/engine-components/ui/Layout.ts +3 -0
  392. package/src/engine-components/ui/Outline.ts +1 -1
  393. package/src/engine-components/ui/PointerEvents.ts +1 -1
  394. package/src/engine-components/ui/Raycaster.ts +57 -8
  395. package/src/engine-components/ui/RectTransform.ts +2 -2
  396. package/src/engine-components/ui/SpatialHtml.ts +1 -1
  397. package/src/engine-components/ui/Text.ts +24 -2
  398. package/src/engine-components/utils/LookAt.ts +1 -1
  399. package/src/engine-components/utils/OpenURL.ts +1 -1
  400. package/src/engine-components/web/Clickthrough.ts +119 -10
  401. package/src/engine-components/web/CursorFollow.ts +174 -9
  402. package/src/engine-components/web/HoverAnimation.ts +142 -13
  403. package/src/engine-components/web/ScrollFollow.ts +4 -1
  404. package/src/engine-components/web/ViewBox.ts +118 -18
  405. package/src/engine-components/webxr/TeleportTarget.ts +23 -4
  406. package/src/engine-components/webxr/WebXR.ts +11 -3
  407. package/src/engine-components/webxr/WebXRAvatar.ts +41 -4
  408. package/src/engine-components/webxr/WebXRImageTracking.ts +282 -38
  409. package/src/engine-components/webxr/WebXRPlaneTracking.ts +1 -1
  410. package/src/engine-components/webxr/XRFlag.ts +30 -3
@@ -14,17 +14,43 @@ import { Behaviour } from "./Component.js";
14
14
  import { Rigidbody } from "./RigidBody.js";
15
15
 
16
16
  /**
17
- * Collider is the base class for all colliders. A collider is a physical shape that is used to detect collisions with other objects in the scene.
18
- * Colliders are used in combination with a {@link Rigidbody} to create physical interactions between objects.
19
- * Colliders are registered with the physics engine when they are enabled and removed when they are disabled.
17
+ * Collider is the base class for all physics collision shapes.
18
+ * Colliders define the physical boundary of objects for collision detection.
20
19
  *
20
+ * ![](https://cloud.needle.tools/-/media/slYWnXyaxdlrCqu8GP_lFQ.gif)
21
+ *
22
+ * **Usage with Rigidbody:**
23
+ * - Add a collider to define collision shape
24
+ * - Add a {@link Rigidbody} to the same or parent object for physics simulation
25
+ * - Without Rigidbody, collider acts as static geometry
26
+ *
27
+ * **Trigger mode:**
28
+ * Set `isTrigger = true` for detection without physical collision.
29
+ * Triggers fire `onTriggerEnter`, `onTriggerStay`, `onTriggerExit` events.
30
+ *
31
+ * **Collision filtering:**
32
+ * Use `membership` and `filter` arrays to control which objects collide.
33
+ *
34
+ * @example Add a box collider to an object
35
+ * ```ts
36
+ * const collider = myObject.addComponent(BoxCollider);
37
+ * collider.size = new Vector3(1, 2, 1);
38
+ * collider.center = new Vector3(0, 1, 0);
39
+ * ```
40
+ *
21
41
  * - Example: https://samples.needle.tools/physics-basic
22
42
  * - Example: https://samples.needle.tools/physics-playground
23
- * - Example: https://samples.needle.tools/physics-&-animation
24
- *
25
- * @summary Physics collider
26
- * @category Physics
43
+ *
44
+ * @summary Physics collider base class
45
+ * @category Physics
27
46
  * @group Components
47
+ * @see {@link BoxCollider} for box-shaped colliders
48
+ * @see {@link SphereCollider} for sphere-shaped colliders
49
+ * @see {@link CapsuleCollider} for capsule-shaped colliders
50
+ * @see {@link MeshCollider} for mesh-based colliders
51
+ * @see {@link Rigidbody} for physics simulation
52
+ * @link https://engine.needle.tools/samples/?room=needle272&overlay=samples&tag=physics
53
+ * @link https://engine.needle.tools/samples-uploads/basic-physics/?showcolliders
28
54
  */
29
55
  export abstract class Collider extends Behaviour implements ICollider {
30
56
 
@@ -116,15 +142,26 @@ export abstract class Collider extends Behaviour implements ICollider {
116
142
  }
117
143
 
118
144
  /**
119
- * SphereCollider represents a sphere-shaped collision volume.
120
- * Useful for objects that are roughly spherical in shape or need a simple collision boundary.
145
+ * SphereCollider represents a sphere-shaped collision volume.
146
+ * Efficient and suitable for balls, projectiles, or approximate collision bounds.
121
147
  *
148
+ * ![](https://cloud.needle.tools/-/media/slYWnXyaxdlrCqu8GP_lFQ.gif)
149
+ *
150
+ * @example Create a bouncing ball
151
+ * ```ts
152
+ * const sphere = ball.addComponent(SphereCollider);
153
+ * sphere.radius = 0.5;
154
+ * const rb = ball.addComponent(Rigidbody);
155
+ * rb.mass = 1;
156
+ * ```
157
+ *
122
158
  * - Example: https://samples.needle.tools/physics-basic
123
- * - Example: https://samples.needle.tools/physics-playground
124
- * - Example: https://samples.needle.tools/physics-&-animation
125
- *
159
+ *
160
+ * @summary Sphere-shaped physics collider
126
161
  * @category Physics
127
162
  * @group Components
163
+ * @see {@link Collider} for base collider functionality
164
+ * @see {@link CapsuleCollider} for elongated sphere shapes
128
165
  */
129
166
  export class SphereCollider extends Collider implements ISphereCollider {
130
167
 
@@ -167,15 +204,31 @@ export class SphereCollider extends Collider implements ISphereCollider {
167
204
  }
168
205
 
169
206
  /**
170
- * BoxCollider represents a box-shaped collision volume.
171
- * Ideal for rectangular objects or objects that need a simple cuboid collision boundary.
207
+ * BoxCollider represents a box-shaped (cuboid) collision volume.
208
+ * Most common collider type, efficient for walls, floors, crates, and rectangular objects.
172
209
  *
210
+ * ![](https://cloud.needle.tools/-/media/slYWnXyaxdlrCqu8GP_lFQ.gif)
211
+ *
212
+ * @example Create a floor collider
213
+ * ```ts
214
+ * const box = floor.addComponent(BoxCollider);
215
+ * box.size = new Vector3(10, 0.1, 10);
216
+ * box.center = new Vector3(0, -0.05, 0);
217
+ * ```
218
+ *
219
+ * @example Auto-fit to mesh geometry
220
+ * ```ts
221
+ * const collider = BoxCollider.add(myMesh, { rigidbody: true });
222
+ * // Collider size is automatically set from mesh bounds
223
+ * ```
224
+ *
173
225
  * - Example: https://samples.needle.tools/physics-basic
174
- * - Example: https://samples.needle.tools/physics-playground
175
- * - Example: https://samples.needle.tools/physics-&-animation
176
- *
226
+ *
227
+ * @summary Box-shaped physics collider
177
228
  * @category Physics
178
229
  * @group Components
230
+ * @see {@link Collider} for base collider functionality
231
+ * @see {@link SphereCollider} for sphere shapes
179
232
  */
180
233
  export class BoxCollider extends Collider implements IBoxCollider {
181
234
 
@@ -274,8 +327,10 @@ export class BoxCollider extends Collider implements IBoxCollider {
274
327
  }
275
328
 
276
329
  /**
277
- * MeshCollider creates a collision shape from a mesh geometry.
278
- * Allows for complex collision shapes that match the exact geometry of an object.
330
+ * MeshCollider creates a collision shape from a mesh geometry.
331
+ * Allows for complex collision shapes that match the exact geometry of an object.
332
+ *
333
+ * ![](https://cloud.needle.tools/-/media/slYWnXyaxdlrCqu8GP_lFQ.gif)
279
334
  *
280
335
  * - Example: https://samples.needle.tools/physics-basic
281
336
  * - Example: https://samples.needle.tools/physics-playground
@@ -362,8 +417,10 @@ export class MeshCollider extends Collider {
362
417
  }
363
418
 
364
419
  /**
365
- * CapsuleCollider represents a capsule-shaped collision volume (cylinder with hemispherical ends).
366
- * Ideal for character controllers and objects that need a rounded collision shape.
420
+ * CapsuleCollider represents a capsule-shaped collision volume (cylinder with hemispherical ends).
421
+ * Ideal for character controllers and objects that need a rounded collision shape.
422
+ *
423
+ * ![](https://cloud.needle.tools/-/media/slYWnXyaxdlrCqu8GP_lFQ.gif)
367
424
  *
368
425
  * - Example: https://samples.needle.tools/physics-basic
369
426
  * - Example: https://samples.needle.tools/physics-playground
@@ -44,19 +44,38 @@ type FitParameters = {
44
44
  // - node can simply be scaled in Y to adjust max. ground height
45
45
 
46
46
  /**
47
- * ContactShadows is a component that allows to display contact shadows in the scene. It has options for darkness, opacity and blur of the shadows.
48
- *
49
- * - Example: https://samples.needle.tools/contact-shadows
50
- *
51
- * ## Usage
52
- * You can use {@link ContactShadows.auto} to automatically create a ContactShadows instance for the scene or you can add the component to an object in the scene. Note that the scale of the object will be used to define the size of the shadow area.
53
- *
54
- * ContactShadows can also be enabled on the `<needle-engine>` web component directly by adding the `contactshadows` attribute. The value of the attribute will be used as opacity and darkness of the shadows: `<needle-engine contactshadows="0.7">`.
47
+ * [ContactShadows](https://engine.needle.tools/docs/api/ContactShadows) renders proximity-based soft shadows on flat surfaces.
48
+ * Ideal for products or objects that need visual grounding without real-time shadows.
55
49
  *
50
+ * ![](https://cloud.needle.tools/-/media/87bPTNXHcsbV-An-oSEvHQ.gif)
51
+ *
52
+ * **Setup options:**
53
+ * 1. `ContactShadows.auto(context)` - Auto-create and fit to scene
54
+ * 2. Add component manually to control position and scale
55
+ * 3. HTML attribute: `<needle-engine contactshadows="0.7">`
56
+ *
57
+ * **Properties:**
58
+ * - `opacity` / `darkness` - Shadow intensity
59
+ * - `blur` - Softness of shadow edges
60
+ * - Object scale defines shadow area size
61
+ *
62
+ * **Debug:** Use `?debugcontactshadows` URL parameter.
63
+ *
64
+ *
65
+ * @example Auto-create contact shadows
66
+ * ```ts
67
+ * const shadows = ContactShadows.auto(this.context);
68
+ * shadows.opacity = 0.5;
69
+ * shadows.darkness = 0.8;
70
+ * ```
71
+ *
56
72
  * @summary Display contact shadows on the ground
57
73
  * @category Rendering
58
74
  * @group Components
59
- */
75
+ * @see {@link Light} for real-time shadow casting
76
+ * @see {@link Renderer} for material/rendering control
77
+ * @link https://engine.needle.tools/samples/contact-shadows for a demo of contact shadows
78
+ */
60
79
  export class ContactShadows extends Behaviour {
61
80
 
62
81
  private static readonly _instances: Map<Context, ContactShadows> = new Map();
@@ -161,6 +180,7 @@ export class ContactShadows extends Behaviour {
161
180
  private occluderMesh?: Mesh;
162
181
  private blurPlane?: Mesh;
163
182
 
183
+ private planeMaterial?: MeshBasicMaterial;
164
184
  private depthMaterial?: MeshDepthMaterial;
165
185
  private horizontalBlurMaterial?: ShaderMaterial;
166
186
  private verticalBlurMaterial?: ShaderMaterial;
@@ -258,7 +278,7 @@ export class ContactShadows extends Behaviour {
258
278
  // mat.depthWrite = false;
259
279
  }
260
280
 
261
- const planeMaterial = new MeshBasicMaterial({
281
+ const planeMaterial = this.planeMaterial = new MeshBasicMaterial({
262
282
  map: this.renderTarget.texture,
263
283
  opacity: this.opacity,
264
284
  color: 0x000000,
@@ -376,11 +396,16 @@ export class ContactShadows extends Behaviour {
376
396
  if (!this.renderTarget || !this.renderTargetBlur ||
377
397
  !this.depthMaterial || !this.shadowCamera ||
378
398
  !this.blurPlane || !this.shadowGroup || !this.plane ||
379
- !this.horizontalBlurMaterial || !this.verticalBlurMaterial) {
399
+ !this.horizontalBlurMaterial || !this.verticalBlurMaterial || !this.planeMaterial) {
380
400
  if (debug) console.error("ContactShadows: not initialized yet");
381
401
  return;
382
402
  }
383
403
 
404
+ // Update properties that might have been changed
405
+ this.depthMaterial.userData.darkness.value = this.darkness;
406
+ this.planeMaterial.opacity = this.opacity;
407
+
408
+
384
409
  const scene = this.context.scene;
385
410
  const renderer = this.context.renderer;
386
411
  const initialRenderTarget = renderer.getRenderTarget();
@@ -10,11 +10,37 @@ import { UsageMarker } from "./Interactable.js";
10
10
 
11
11
  const debug = getParam("debugdeletable");
12
12
  /**
13
- * A box-shaped area that can be used to delete objects that get into it. Useful for sandbox-style builders or physics simulations.
13
+ * The [DeleteBox](https://engine.needle.tools/docs/api/DeleteBox) component creates an invisible deletion zone that destroys objects entering it.
14
+ * Works with objects that have a {@link Deletable} component attached.
14
15
  *
16
+ * ![](https://cloud.needle.tools/-/media/J-Gmdhl214kfdjkfYViG8g.gif)
17
+ *
18
+ * **Use cases:**
19
+ * - Trash bins in sandbox builders
20
+ * - Kill zones in physics simulations
21
+ * - Cleanup areas for multiplayer scenes
22
+ *
23
+ * **Setup:**
24
+ * 1. Add DeleteBox to a GameObject with a BoxCollider-like shape
25
+ * 2. Add {@link Deletable} component to objects that should be destroyable
26
+ * 3. Objects entering the box will be destroyed (synced across network)
27
+ *
28
+ * **Debug:** Use `?debugdeletable` URL parameter to visualize deletion areas.
29
+ *
30
+ * - Example: https://engine.needle.tools/samples/collaborative-sandbox
31
+ *
32
+ * @example Create a deletion zone
33
+ * ```ts
34
+ * const trashBin = trashBinModel.addComponent(DeleteBox);
35
+ * // Objects with Deletable component will be destroyed when entering
36
+ * ```
37
+ *
15
38
  * @summary Box area that deletes objects entering it
16
39
  * @category Interactivity
17
40
  * @group Components
41
+ * @see {@link Deletable} - Add to objects that can be destroyed
42
+ * @see {@link Duplicatable} for spawning objects
43
+ * @see {@link DragControls} for moving objects
18
44
  */
19
45
  export class DeleteBox extends BoxHelperComponent {
20
46
  static _instances: DeleteBox[] = [];
@@ -29,9 +55,24 @@ export class DeleteBox extends BoxHelperComponent {
29
55
  }
30
56
  }
31
57
 
32
- /** Objects with this component can be destroyed by the {@link DeleteBox} component.
58
+ /**
59
+ * Marks a GameObject as deletable by {@link DeleteBox} zones.
60
+ * Objects with this component will be destroyed (and synced across network)
61
+ * when they enter a DeleteBox area.
62
+ *
63
+ * **Note:** Objects currently being used (with {@link UsageMarker}) are protected from deletion.
64
+ *
65
+ * @example Make an object deletable
66
+ * ```ts
67
+ * const deletable = spawnedObject.addComponent(Deletable);
68
+ * // Object can now be destroyed by entering a DeleteBox
69
+ * ```
70
+ *
71
+ * @summary Marks object as destroyable by DeleteBox
33
72
  * @category Interactivity
34
73
  * @group Components
74
+ * @see {@link DeleteBox} for the deletion trigger
75
+ * @see {@link UsageMarker} for protecting objects in use
35
76
  */
36
77
  export class Deletable extends Behaviour {
37
78
 
@@ -11,12 +11,31 @@ export enum DeviceType {
11
11
  }
12
12
 
13
13
  /**
14
- * Enables or disables the GameObject based on the device type (mobile or desktop).
15
- * You can use this to show or hide objects depending on whether the user is on a mobile device or a desktop.
16
- *
14
+ * DeviceFlag shows or hides GameObjects based on device type.
15
+ * Use for responsive 3D content - show different UI, models, or interactions
16
+ * depending on mobile vs desktop.
17
+ *
18
+ * **Device types:**
19
+ * - `Desktop` - Traditional computers with mouse/keyboard
20
+ * - `Mobile` - Phones and tablets with touch input
21
+ * - Combine with bitwise OR for multiple: `Desktop | Mobile`
22
+ *
23
+ * @example Show only on desktop
24
+ * ```ts
25
+ * const flag = myObject.addComponent(DeviceFlag);
26
+ * flag.visibleOn = DeviceType.Desktop;
27
+ * ```
28
+ *
29
+ * @example Show on both mobile and desktop
30
+ * ```ts
31
+ * flag.visibleOn = DeviceType.Desktop | DeviceType.Mobile;
32
+ * ```
33
+ *
17
34
  * @summary Show or hide GameObject based on device type
18
35
  * @category Utilities
19
36
  * @group Components
37
+ * @see {@link DeviceType} for device options
38
+ * @see {@link XRFlag} for XR-based visibility
20
39
  */
21
40
  export class DeviceFlag extends Behaviour {
22
41
 
@@ -43,12 +43,42 @@ export enum DragMode {
43
43
  }
44
44
 
45
45
  /**
46
- * DragControls allows you to drag objects around in the scene. It can be used to move objects in 2D (screen space) or 3D (world space).
47
- * Debug mode can be enabled with the URL parameter `?debugdrag`, which shows visual helpers and logs drag operations.
46
+ * [DragControls](https://engine.needle.tools/docs/api/DragControls) enables interactive dragging of objects in 2D (screen space) or 3D (world space).
47
+ *
48
+ * ![](https://cloud.needle.tools/-/media/HyrtRDLjdmndr23_SR4mYw.gif)
48
49
  *
50
+ * **Drag modes:**
51
+ * - `XZPlane` - Drag on horizontal plane (good for floor objects)
52
+ * - `Attached` - Follow pointer directly (screen plane in 2D, controller in XR)
53
+ * - `HitNormal` - Drag along the surface normal where clicked
54
+ * - `DynamicViewAngle` - Auto-switch between XZ and screen based on view angle
55
+ * - `SnapToSurfaces` - Snap to scene geometry while dragging
56
+ *
57
+ * **Features:**
58
+ * - Works across desktop, mobile, VR, and AR
59
+ * - Optional grid snapping (`snapGridResolution`)
60
+ * - Rotation preservation (`keepRotation`)
61
+ * - Automatic networking with {@link SyncedTransform}
62
+ *
63
+ *
64
+ * **Debug:** Use `?debugdrag` URL parameter for visual helpers.
65
+ *
66
+ * @example Basic draggable object
67
+ * ```ts
68
+ * const drag = myObject.addComponent(DragControls);
69
+ * drag.dragMode = DragMode.XZPlane;
70
+ * drag.snapGridResolution = 0.5; // Snap to 0.5 unit grid
71
+ * ```
72
+ *
73
+ * - Example: https://engine.needle.tools/samples/collaborative-sandbox
74
+ *
49
75
  * @summary Enables dragging of objects in 2D or 3D space
50
76
  * @category Interactivity
51
77
  * @group Components
78
+ * @see {@link DragMode} for available drag behaviors
79
+ * @see {@link Duplicatable} for drag-to-duplicate functionality
80
+ * @see {@link SyncedTransform} for networked dragging
81
+ * @see {@link ObjectRaycaster} for pointer detection
52
82
  */
53
83
  export class DragControls extends Behaviour implements IPointerEventHandler {
54
84
 
@@ -1,9 +1,9 @@
1
1
  import { Box3, Object3D, Vector2, Vector3 } from "three";
2
2
 
3
3
  import { isDevEnvironment } from "../engine/debug/index.js";
4
+ import type { AssetReference } from "../engine/engine_addressables.js"
4
5
  import { AnimationUtils } from "../engine/engine_animation.js";
5
6
  import { Context } from "../engine/engine_context.js";
6
- import { destroy } from "../engine/engine_gameobject.js";
7
7
  import { Gizmos } from "../engine/engine_gizmos.js";
8
8
  import { getLoader } from "../engine/engine_gltf.js";
9
9
  import { BlobStorage } from "../engine/engine_networking_blob.js";
@@ -109,40 +109,52 @@ class DropListenerAddedEvent<T extends DropListenerOnDropArguments> extends Cust
109
109
  */
110
110
  const blobKeyName = "blob";
111
111
 
112
- /** The DropListener component is used to listen for drag and drop events in the browser and add the dropped files to the scene
113
- * It can be used to allow users to drag and drop glTF files into the scene to add new objects.
114
- * Existing child objects will behave like placeholders and will be removed when new files are dropped.
115
- *
116
- * If {@link useNetworking} is enabled, the DropListener will automatically synchronize dropped files to other connected clients.
117
- * Enable {@link fitIntoVolume} to automatically scale dropped objects to fit within the volume defined by {@link fitVolumeSize}.
118
- *
119
- * - Example: [DropListener Sample](https://droplistener-zubcksz1veaoo.needle.run/)
120
- *
121
- * The following events are dispatched by the DropListener:
122
- * - **object-added** - dispatched when a new object is added to the scene
123
- * - **file-dropped** - dispatched when a file is dropped into the scene
124
- *
125
- * @example
126
- * ```typescript
127
- * import { DropListener, DropListenerEvents } from "@needle-tools/engine";
128
- *
129
- * const dropListener = new DropListener();
130
- *
131
- * gameObject.addComponent(dropListener);
132
- * dropListener.on(DropListenerEvents.FileDropped, (evt) => {
133
- * console.log("File dropped", evt.detail);
134
- * const file = evt.detail as File;
135
- * });
112
+ /**
113
+ * DropListener enables drag-and-drop loading of 3D files directly into your scene.
114
+ * Users can drop glTF/GLB files onto the canvas to dynamically add new objects at runtime.
136
115
  *
116
+ * [![](https://cloud.needle.tools/-/media/p5LNPTQ0u4mRXA6WiSmzIQ.gif)](https://engine.needle.tools/samples/droplistener)
117
+ *
118
+ * **Supported formats:** glTF, GLB, FBX, OBJ, USDZ, VRM
119
+ *
120
+ * **Key features:**
121
+ * - Drop files directly onto canvas or onto a specific {@link dropArea}
122
+ * - Paste URLs from clipboard (Ctrl/Cmd+V)
123
+ * - Auto-fit objects to a specific size with {@link fitIntoVolume}
124
+ * - Network sync to share dropped objects with other users
125
+ * - Special handling for GitHub and Polyhaven URLs
126
+ *
127
+ * **Events:**
128
+ * - `file-dropped` - Fired for each dropped file
129
+ * - `object-added` - Fired when object is loaded and added to scene
130
+ *
131
+ * **Debug:** Use `?debugdroplistener` URL parameter
132
+ *
133
+ * @example Listen for dropped objects
134
+ * ```ts
135
+ * const dropListener = myObject.addComponent(DropListener);
136
+ * dropListener.useNetworking = true;
137
+ * dropListener.fitIntoVolume = true;
138
+ *
137
139
  * dropListener.on(DropListenerEvents.ObjectAdded, (evt) => {
138
- * console.log("Object added", evt.detail);
139
- * const gltf = evt.detail as GLTF;
140
+ * const { object, model } = evt.detail;
141
+ * console.log("Added:", object.name);
140
142
  * });
141
143
  * ```
142
- *
143
- * @summary Component to handle drag and drop of files into the scene
144
+ *
145
+ * @example Load from URL programmatically
146
+ * ```ts
147
+ * const obj = await dropListener.loadFromURL("https://example.com/model.glb");
148
+ * ```
149
+ * Hint: We recommend to use {@link AssetReference} for preloading and referencing assets in code if you simply want to load a model.
150
+ *
151
+ * @summary Drag-and-drop file loading for 3D assets
144
152
  * @category Asset Management
145
153
  * @group Components
154
+ * @see {@link SceneSwitcher} for loading entire scenes
155
+ * @see {@link AssetReference} for preloading assets
156
+ * @see {@link SyncedTransform} for networking support
157
+ * @link https://engine.needle.tools/samples/droplistener for a live demo
146
158
  */
147
159
  export class DropListener extends Behaviour {
148
160
 
@@ -12,26 +12,57 @@ import { type IPointerEventHandler, PointerEventData } from "./ui/PointerEvents.
12
12
  import { ObjectRaycaster } from "./ui/Raycaster.js";
13
13
 
14
14
  /**
15
- * The Duplicatable component is used to duplicate a assigned {@link GameObject} when a pointer event occurs on the object.
16
- *
15
+ * The [Duplicatable](https://engine.needle.tools/docs/api/Duplicatable) component creates clones of a GameObject when clicked/tapped/dragged.
16
+ * Perfect for spawning objects, creating drag-and-drop inventories, or multiplayer object creation.
17
+ *
18
+ * ![](https://cloud.needle.tools/-/media/J_ij9vxhh1zhS8h2ftGBXQ.gif)
19
+ *
20
+ * **How it works:**
21
+ * - When the user clicks on this object, it creates a clone of the assigned `object`
22
+ * - The clone is automatically set up with {@link DragControls} so users can drag it
23
+ * - If networking is enabled, clones are synced via {@link SyncedTransform}
24
+ * - Rate limiting prevents spam (controlled by `limitCount`)
25
+ *
26
+ * **Setup tips:**
27
+ * - Assign `object` to a template object (it will be hidden and used as source)
28
+ * - If `object` is not assigned, the component's own GameObject is used as template
29
+ * - Add an {@link ObjectRaycaster} to enable pointer detection (added automatically if missing)
30
+ *
31
+ * @example Basic duplicatable button
32
+ * ```ts
33
+ * const duplicatable = spawnButton.addComponent(Duplicatable);
34
+ * duplicatable.object = templateObject; // Object to clone
35
+ * duplicatable.parent = spawnContainer; // Where to place clones
36
+ * duplicatable.limitCount = 10; // Max 10 per second
37
+ * ```
38
+ *
17
39
  * @summary Duplicates a GameObject on pointer events
18
40
  * @category Interactivity
19
41
  * @group Components
42
+ * @see {@link DragControls} for dragging the duplicated objects
43
+ * @see {@link SyncedTransform} for networking support
44
+ * @see {@link GameObject.instantiateSynced} for the underlying instantiation
45
+ * @link https://engine.needle.tools/samples/collaborative-sandbox/
20
46
  */
21
47
  export class Duplicatable extends Behaviour implements IPointerEventHandler {
22
48
 
23
- /** Duplicates will be parented into the set object. If not defined, this GameObject will be used as parent. */
49
+ /**
50
+ * Parent object for spawned duplicates.
51
+ * If not set, duplicates are parented to this GameObject's parent.
52
+ */
24
53
  @serializable(Object3D)
25
54
  parent: GameObject | null = null;
26
55
 
27
- /** The object to be duplicated. If no object is assigned then the object the Duplicatable component is attached to will be used for cloning.
28
- * @default null
56
+ /**
57
+ * Template object to duplicate. This object will be hidden and used as the source for clones.
58
+ * If not assigned, this GameObject itself is used as the template.
29
59
  */
30
60
  @serializable(Object3D)
31
61
  object: GameObject | null = null;
32
62
 
33
63
  /**
34
- * The maximum number of objects that can be duplicated in the interval.
64
+ * Maximum duplications allowed per second to prevent spam.
65
+ * The counter decreases by 1 each second.
35
66
  * @default 60
36
67
  */
37
68
  @serializable()
@@ -4,6 +4,9 @@ import type { IComponent, IEventList } from "../engine/engine_types.js";
4
4
 
5
5
  const argumentsBuffer = new Array<any>();
6
6
 
7
+ /**
8
+ * CallInfo represents a single callback method that can be invoked by the {@link EventList}.
9
+ */
7
10
  export class CallInfo {
8
11
  /**
9
12
  * When the CallInfo is enabled it will be invoked when the EventList is invoked
@@ -101,24 +104,49 @@ export class EventListEvent<TArgs extends any> extends Event { //implements Arra
101
104
 
102
105
 
103
106
  /**
104
- * The EventList is a class that can be used to create a list of event listeners that can be invoked.
105
- *
106
- * @example
107
- * ```ts
108
- * // create an event list
109
- * const onClick = new EventList<(event: MouseEvent) => void>();
107
+ * EventList manages a list of callbacks that can be invoked together.
108
+ * Used for Unity-style events that can be configured in the editor (Unity or Blender).
109
+ *
110
+ * **Serialization:**
111
+ * EventLists are serializable - callbacks configured in Unity/Blender will work at runtime.
112
+ * Mark fields with `@serializable(EventList)` for editor support.
113
+ *
114
+ * **Usage patterns:**
115
+ * - Button click handlers
116
+ * - Animation events
117
+ * - Custom component callbacks
118
+ * - Scene loading events
110
119
  *
111
- * // add an event listener
112
- * onClick.addEventListener((event) => {
113
- * console.log("Clicked!", event);
114
- * });
120
+ * ![](https://cloud.needle.tools/-/media/P7bEKQvfgRUMTb2Wi1hWXg.png)
121
+ * *Screenshot of a Unity component with an EventList field*
115
122
  *
116
- * // invoke the event list
117
- * onClick.invoke(new MouseEvent("click"));
123
+ * ![](https://cloud.needle.tools/-/media/i2hi2OHfbaDyHyBL6Gt58A.png)
124
+ * *Screenshot of a Blender component with an EventList field*
125
+ *
126
+ * @example Create and use an EventList
127
+ * ```ts
128
+ * // Define in your component
129
+ * @serializable(EventList)
130
+ * onClick: EventList = new EventList();
131
+ *
132
+ * // Add listeners
133
+ * this.onClick.addEventListener(() => console.log("Clicked!"));
134
+ *
135
+ * // Invoke all listeners
136
+ * this.onClick.invoke();
118
137
  * ```
119
- *
138
+ *
139
+ * @example Listen with arguments
140
+ * ```ts
141
+ * const onScore = new EventList<{ points: number }>();
142
+ * onScore.addEventListener(data => console.log("Scored:", data.points));
143
+ * onScore.invoke({ points: 100 });
144
+ * ```
145
+ *
120
146
  * @category Events
121
147
  * @group Utilities
148
+ * @see {@link CallInfo} for individual callback configuration
149
+ * @see {@link Button} for UI button events
122
150
  */
123
151
  export class EventList<TArgs extends any = any> implements IEventList {
124
152
 
@@ -12,7 +12,7 @@ class TriggerEvent {
12
12
  }
13
13
 
14
14
  /**
15
- * The EventTrigger component is used to trigger events when certain pointer events occur on the GameObject.
15
+ * The [EventTrigger](https://engine.needle.tools/docs/api/EventTrigger) component is used to trigger events when certain pointer events occur on the GameObject.
16
16
  * It implements the {@link IPointerEventHandler} interface and can be used to expose events to the user in the editor without writing code.
17
17
  *
18
18
  * @summary Triggers events on pointer interactions
@@ -4,15 +4,37 @@ import { serializable } from "../engine/engine_serialization.js";
4
4
  import { Behaviour } from "./Component.js";
5
5
 
6
6
 
7
+ /**
8
+ * Fog rendering mode
9
+ */
7
10
  enum FogMode {
11
+ /** Linear fog increases uniformly with distance */
8
12
  Linear = 1,
13
+ /** Exponential fog increases exponentially with distance */
9
14
  Exponential = 2,
15
+ /** Exponential squared fog for denser falloff */
10
16
  ExponentialSquared = 3,
11
17
  }
12
18
 
13
- /** @internal */
19
+ /**
20
+ * Adds distance-based fog effect to the scene.
21
+ * When enabled, objects will fade into the fog color based on their distance from the camera.
22
+ *
23
+ * This component is automatically added to the scene when fog is enabled in the editor.
24
+ * For setting fog from code you can simply use `scene.fog = new Fog3(color, near, far)` without adding this component.
25
+ *
26
+ * @summary Adds fog effect to the scene
27
+ * @category Rendering
28
+ * @group Components
29
+ * @link https://threejs.org/docs/#Fog
30
+ */
14
31
  export class Fog extends Behaviour {
15
32
 
33
+ /**
34
+ * The underlying Three.js Fog object. You can modify its properties directly for more advanced control.
35
+ * @remarks The Fog component provides convenient access to common fog properties like `near`, `far`, and `color`. Modifying those will update the underlying `fog` object accordingly. However, you can also access and modify the `fog` object directly for more advanced use cases, such as changing the fog mode or using a custom shader.
36
+ * @link https://threejs.org/docs/#Fog for available properties and methods on the Fog object.
37
+ */
16
38
  get fog() {
17
39
  if (!this._fog) this._fog = new Fog3(0x000000, 0, 50);
18
40
  return this._fog;