@needle-tools/engine 4.12.5 → 4.13.0-next.1eca7a7

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 (322) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +38 -1
  3. package/components.needle.json +1 -1
  4. package/custom-elements.json +156 -5
  5. package/dist/{gltf-progressive-BqUnxvCx.umd.cjs → gltf-progressive-BURrJW0U.umd.cjs} +1 -1
  6. package/dist/{gltf-progressive-CSaX5HQb.min.js → gltf-progressive-DHLDFNvQ.min.js} +1 -1
  7. package/dist/{gltf-progressive-ChnIhDXx.js → gltf-progressive-eiJCrjLb.js} +3 -3
  8. package/dist/materialx-B9ddsHcF.min.js +90 -0
  9. package/dist/materialx-BF23AVE8.umd.cjs +90 -0
  10. package/dist/materialx-fkoFuRh3.js +4636 -0
  11. package/dist/{needle-engine.bundle-Cnemui9H.umd.cjs → needle-engine.bundle-BfrDWglE.umd.cjs} +124 -124
  12. package/dist/{needle-engine.bundle-B_IGIr6Z.min.js → needle-engine.bundle-Bx_Lq_3v.min.js} +131 -131
  13. package/dist/{needle-engine.bundle-Cj66livk.js → needle-engine.bundle-MQyZGnMF.js} +3754 -3374
  14. package/dist/needle-engine.d.ts +2791 -309
  15. package/dist/needle-engine.js +415 -414
  16. package/dist/needle-engine.min.js +1 -1
  17. package/dist/needle-engine.umd.cjs +1 -1
  18. package/dist/{postprocessing-12-UW7je.min.js → postprocessing-BVNrgYZK.min.js} +1 -1
  19. package/dist/{postprocessing-B3Hu0Ryi.umd.cjs → postprocessing-CI2TjWpu.umd.cjs} +1 -1
  20. package/dist/{postprocessing-R535krvT.js → postprocessing-DdM-tz1j.js} +2 -2
  21. package/dist/{three-BzxwLtUE.umd.cjs → three-BW2s1Yl-.umd.cjs} +25 -25
  22. package/dist/{three-DMvLgxja.min.js → three-I__hSXzr.min.js} +26 -26
  23. package/dist/{three-D9pcFbxc.js → three-VvRoMeIN.js} +22 -0
  24. package/dist/{three-examples-F0MJj0vr.js → three-examples-BhfOE7NG.js} +1 -1
  25. package/dist/{three-examples-CjSwCv_b.umd.cjs → three-examples-Bpfu6ke_.umd.cjs} +1 -1
  26. package/dist/{three-examples-CIv2roOA.min.js → three-examples-D8zAE_7t.min.js} +1 -1
  27. package/dist/{three-mesh-ui-BLnJQzMl.umd.cjs → three-mesh-ui-BU55xDxJ.umd.cjs} +1 -1
  28. package/dist/{three-mesh-ui-BllgajJz.min.js → three-mesh-ui-C3QbemOV.min.js} +1 -1
  29. package/dist/{three-mesh-ui-DYyiRn5Y.js → three-mesh-ui-CcMp-FQm.js} +1 -1
  30. package/dist/{vendor-BIFy-gRe.js → vendor-BiyIZ61v.js} +1 -1
  31. package/dist/{vendor-BFgQSG2m.umd.cjs → vendor-COVQl0b8.umd.cjs} +1 -1
  32. package/dist/{vendor-ChgmXMYr.min.js → vendor-DW7zqjuT.min.js} +1 -1
  33. package/lib/engine/engine_context.d.ts +16 -0
  34. package/lib/engine/engine_context.js +16 -0
  35. package/lib/engine/engine_context.js.map +1 -1
  36. package/lib/engine/engine_gameobject.d.ts +72 -0
  37. package/lib/engine/engine_gameobject.js +38 -0
  38. package/lib/engine/engine_gameobject.js.map +1 -1
  39. package/lib/engine/engine_input.d.ts +80 -4
  40. package/lib/engine/engine_input.js +78 -2
  41. package/lib/engine/engine_input.js.map +1 -1
  42. package/lib/engine/engine_loaders.js +7 -1
  43. package/lib/engine/engine_loaders.js.map +1 -1
  44. package/lib/engine/engine_math.d.ts +81 -2
  45. package/lib/engine/engine_math.js +68 -2
  46. package/lib/engine/engine_math.js.map +1 -1
  47. package/lib/engine/engine_modules.d.ts +9 -0
  48. package/lib/engine/engine_modules.js +25 -0
  49. package/lib/engine/engine_modules.js.map +1 -1
  50. package/lib/engine/engine_networking.d.ts +181 -14
  51. package/lib/engine/engine_networking.js +181 -14
  52. package/lib/engine/engine_networking.js.map +1 -1
  53. package/lib/engine/engine_networking_auto.d.ts +35 -8
  54. package/lib/engine/engine_networking_auto.js +35 -8
  55. package/lib/engine/engine_networking_auto.js.map +1 -1
  56. package/lib/engine/engine_physics.d.ts +35 -1
  57. package/lib/engine/engine_physics.js +35 -1
  58. package/lib/engine/engine_physics.js.map +1 -1
  59. package/lib/engine/engine_physics_rapier.d.ts +76 -0
  60. package/lib/engine/engine_physics_rapier.js +76 -0
  61. package/lib/engine/engine_physics_rapier.js.map +1 -1
  62. package/lib/engine/engine_serialization_decorator.d.ts +28 -2
  63. package/lib/engine/engine_serialization_decorator.js +28 -2
  64. package/lib/engine/engine_serialization_decorator.js.map +1 -1
  65. package/lib/engine/engine_time.d.ts +23 -3
  66. package/lib/engine/engine_time.js +23 -3
  67. package/lib/engine/engine_time.js.map +1 -1
  68. package/lib/engine/engine_util_decorator.d.ts +31 -1
  69. package/lib/engine/engine_util_decorator.js +31 -1
  70. package/lib/engine/engine_util_decorator.js.map +1 -1
  71. package/lib/engine/engine_utils.d.ts +21 -5
  72. package/lib/engine/engine_utils.js +21 -5
  73. package/lib/engine/engine_utils.js.map +1 -1
  74. package/lib/engine/engine_utils_format.d.ts +1 -1
  75. package/lib/engine/engine_utils_format.js +4 -1
  76. package/lib/engine/engine_utils_format.js.map +1 -1
  77. package/lib/engine/extensions/NEEDLE_materialx.d.ts +29 -0
  78. package/lib/engine/extensions/NEEDLE_materialx.js +115 -0
  79. package/lib/engine/extensions/NEEDLE_materialx.js.map +1 -0
  80. package/lib/engine/extensions/extensions.js +2 -0
  81. package/lib/engine/extensions/extensions.js.map +1 -1
  82. package/lib/engine/extensions/index.d.ts +1 -0
  83. package/lib/engine/extensions/index.js +1 -0
  84. package/lib/engine/extensions/index.js.map +1 -1
  85. package/lib/engine-components/AlignmentConstraint.d.ts +23 -3
  86. package/lib/engine-components/AlignmentConstraint.js +23 -3
  87. package/lib/engine-components/AlignmentConstraint.js.map +1 -1
  88. package/lib/engine-components/Animation.d.ts +42 -0
  89. package/lib/engine-components/Animation.js +36 -0
  90. package/lib/engine-components/Animation.js.map +1 -1
  91. package/lib/engine-components/Animator.d.ts +37 -4
  92. package/lib/engine-components/Animator.js +37 -4
  93. package/lib/engine-components/Animator.js.map +1 -1
  94. package/lib/engine-components/AudioSource.d.ts +32 -10
  95. package/lib/engine-components/AudioSource.js +32 -10
  96. package/lib/engine-components/AudioSource.js.map +1 -1
  97. package/lib/engine-components/AxesHelper.d.ts +22 -3
  98. package/lib/engine-components/AxesHelper.js +22 -3
  99. package/lib/engine-components/AxesHelper.js.map +1 -1
  100. package/lib/engine-components/BasicIKConstraint.d.ts +27 -4
  101. package/lib/engine-components/BasicIKConstraint.js +27 -4
  102. package/lib/engine-components/BasicIKConstraint.js.map +1 -1
  103. package/lib/engine-components/Camera.d.ts +31 -1
  104. package/lib/engine-components/Camera.js +31 -1
  105. package/lib/engine-components/Camera.js.map +1 -1
  106. package/lib/engine-components/CharacterController.d.ts +67 -3
  107. package/lib/engine-components/CharacterController.js +67 -3
  108. package/lib/engine-components/CharacterController.js.map +1 -1
  109. package/lib/engine-components/Collider.d.ts +69 -12
  110. package/lib/engine-components/Collider.js +69 -12
  111. package/lib/engine-components/Collider.js.map +1 -1
  112. package/lib/engine-components/ContactShadows.d.ts +26 -6
  113. package/lib/engine-components/ContactShadows.js +46 -8
  114. package/lib/engine-components/ContactShadows.js.map +1 -1
  115. package/lib/engine-components/DeleteBox.d.ts +43 -2
  116. package/lib/engine-components/DeleteBox.js +43 -2
  117. package/lib/engine-components/DeleteBox.js.map +1 -1
  118. package/lib/engine-components/DeviceFlag.d.ts +21 -2
  119. package/lib/engine-components/DeviceFlag.js +21 -2
  120. package/lib/engine-components/DeviceFlag.js.map +1 -1
  121. package/lib/engine-components/DragControls.d.ts +32 -2
  122. package/lib/engine-components/DragControls.js +32 -2
  123. package/lib/engine-components/DragControls.js.map +1 -1
  124. package/lib/engine-components/DropListener.d.ts +33 -21
  125. package/lib/engine-components/DropListener.js +33 -21
  126. package/lib/engine-components/DropListener.js.map +1 -1
  127. package/lib/engine-components/Duplicatable.d.ts +36 -5
  128. package/lib/engine-components/Duplicatable.js +36 -5
  129. package/lib/engine-components/Duplicatable.js.map +1 -1
  130. package/lib/engine-components/EventList.d.ts +38 -10
  131. package/lib/engine-components/EventList.js +38 -10
  132. package/lib/engine-components/EventList.js.map +1 -1
  133. package/lib/engine-components/Fog.d.ts +23 -1
  134. package/lib/engine-components/Fog.js +23 -1
  135. package/lib/engine-components/Fog.js.map +1 -1
  136. package/lib/engine-components/GridHelper.d.ts +18 -2
  137. package/lib/engine-components/GridHelper.js +18 -2
  138. package/lib/engine-components/GridHelper.js.map +1 -1
  139. package/lib/engine-components/GroundProjection.d.ts +24 -2
  140. package/lib/engine-components/GroundProjection.js +24 -2
  141. package/lib/engine-components/GroundProjection.js.map +1 -1
  142. package/lib/engine-components/Interactable.d.ts +17 -2
  143. package/lib/engine-components/Interactable.js +17 -2
  144. package/lib/engine-components/Interactable.js.map +1 -1
  145. package/lib/engine-components/Joints.d.ts +50 -7
  146. package/lib/engine-components/Joints.js +50 -7
  147. package/lib/engine-components/Joints.js.map +1 -1
  148. package/lib/engine-components/LODGroup.d.ts +36 -14
  149. package/lib/engine-components/LODGroup.js +43 -11
  150. package/lib/engine-components/LODGroup.js.map +1 -1
  151. package/lib/engine-components/Light.d.ts +27 -5
  152. package/lib/engine-components/Light.js +27 -5
  153. package/lib/engine-components/Light.js.map +1 -1
  154. package/lib/engine-components/LookAtConstraint.d.ts +22 -7
  155. package/lib/engine-components/LookAtConstraint.js +22 -7
  156. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  157. package/lib/engine-components/NeedleMenu.d.ts +27 -5
  158. package/lib/engine-components/NeedleMenu.js +27 -5
  159. package/lib/engine-components/NeedleMenu.js.map +1 -1
  160. package/lib/engine-components/NestedGltf.d.ts +39 -4
  161. package/lib/engine-components/NestedGltf.js +42 -4
  162. package/lib/engine-components/NestedGltf.js.map +1 -1
  163. package/lib/engine-components/OffsetConstraint.d.ts +27 -3
  164. package/lib/engine-components/OffsetConstraint.js +27 -3
  165. package/lib/engine-components/OffsetConstraint.js.map +1 -1
  166. package/lib/engine-components/OrbitControls.d.ts +41 -3
  167. package/lib/engine-components/OrbitControls.js +41 -3
  168. package/lib/engine-components/OrbitControls.js.map +1 -1
  169. package/lib/engine-components/ReflectionProbe.d.ts +17 -2
  170. package/lib/engine-components/ReflectionProbe.js +28 -10
  171. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  172. package/lib/engine-components/Renderer.d.ts +34 -0
  173. package/lib/engine-components/Renderer.js +35 -2
  174. package/lib/engine-components/Renderer.js.map +1 -1
  175. package/lib/engine-components/SceneSwitcher.d.ts +11 -0
  176. package/lib/engine-components/SceneSwitcher.js +11 -0
  177. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  178. package/lib/engine-components/ScreenCapture.d.ts +38 -6
  179. package/lib/engine-components/ScreenCapture.js +38 -6
  180. package/lib/engine-components/ScreenCapture.js.map +1 -1
  181. package/lib/engine-components/Skybox.js +1 -1
  182. package/lib/engine-components/Skybox.js.map +1 -1
  183. package/lib/engine-components/SmoothFollow.d.ts +66 -7
  184. package/lib/engine-components/SmoothFollow.js +66 -7
  185. package/lib/engine-components/SmoothFollow.js.map +1 -1
  186. package/lib/engine-components/SpatialTrigger.d.ts +48 -1
  187. package/lib/engine-components/SpatialTrigger.js +48 -1
  188. package/lib/engine-components/SpatialTrigger.js.map +1 -1
  189. package/lib/engine-components/SpectatorCamera.d.ts +21 -3
  190. package/lib/engine-components/SpectatorCamera.js +21 -3
  191. package/lib/engine-components/SpectatorCamera.js.map +1 -1
  192. package/lib/engine-components/SyncedRoom.d.ts +6 -0
  193. package/lib/engine-components/SyncedRoom.js +6 -0
  194. package/lib/engine-components/SyncedRoom.js.map +1 -1
  195. package/lib/engine-components/SyncedTransform.d.ts +55 -6
  196. package/lib/engine-components/SyncedTransform.js +55 -6
  197. package/lib/engine-components/SyncedTransform.js.map +1 -1
  198. package/lib/engine-components/TransformGizmo.d.ts +30 -3
  199. package/lib/engine-components/TransformGizmo.js +30 -3
  200. package/lib/engine-components/TransformGizmo.js.map +1 -1
  201. package/lib/engine-components/VideoPlayer.d.ts +33 -6
  202. package/lib/engine-components/VideoPlayer.js +45 -6
  203. package/lib/engine-components/VideoPlayer.js.map +1 -1
  204. package/lib/engine-components/Voip.d.ts +33 -2
  205. package/lib/engine-components/Voip.js +33 -2
  206. package/lib/engine-components/Voip.js.map +1 -1
  207. package/lib/engine-components/export/usdz/USDZExporter.d.ts +47 -13
  208. package/lib/engine-components/export/usdz/USDZExporter.js +47 -13
  209. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  210. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +82 -3
  211. package/lib/engine-components/particlesystem/ParticleSystem.js +82 -3
  212. package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
  213. package/lib/engine-components/timeline/PlayableDirector.d.ts +99 -14
  214. package/lib/engine-components/timeline/PlayableDirector.js +91 -25
  215. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  216. package/lib/engine-components/ui/Button.d.ts +29 -3
  217. package/lib/engine-components/ui/Button.js +29 -3
  218. package/lib/engine-components/ui/Button.js.map +1 -1
  219. package/lib/engine-components/ui/Canvas.d.ts +28 -3
  220. package/lib/engine-components/ui/Canvas.js +28 -3
  221. package/lib/engine-components/ui/Canvas.js.map +1 -1
  222. package/lib/engine-components/ui/Image.d.ts +22 -3
  223. package/lib/engine-components/ui/Image.js +22 -3
  224. package/lib/engine-components/ui/Image.js.map +1 -1
  225. package/lib/engine-components/ui/Raycaster.d.ts +55 -6
  226. package/lib/engine-components/ui/Raycaster.js +55 -6
  227. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  228. package/lib/engine-components/ui/Text.d.ts +23 -1
  229. package/lib/engine-components/ui/Text.js +23 -1
  230. package/lib/engine-components/ui/Text.js.map +1 -1
  231. package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -2
  232. package/lib/engine-components/webxr/TeleportTarget.js +21 -2
  233. package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
  234. package/lib/engine-components/webxr/WebXR.d.ts +10 -2
  235. package/lib/engine-components/webxr/WebXR.js +10 -2
  236. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  237. package/lib/engine-components/webxr/WebXRAvatar.d.ts +39 -2
  238. package/lib/engine-components/webxr/WebXRAvatar.js +35 -3
  239. package/lib/engine-components/webxr/WebXRAvatar.js.map +1 -1
  240. package/lib/engine-components/webxr/WebXRImageTracking.d.ts +266 -30
  241. package/lib/engine-components/webxr/WebXRImageTracking.js +266 -30
  242. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  243. package/lib/engine-components/webxr/XRFlag.d.ts +29 -2
  244. package/lib/engine-components/webxr/XRFlag.js +29 -2
  245. package/lib/engine-components/webxr/XRFlag.js.map +1 -1
  246. package/package.json +3 -2
  247. package/plugins/vite/custom-element-data.js +128 -19
  248. package/plugins/vite/dependencies.js +9 -4
  249. package/plugins/vite/index.js +0 -2
  250. package/src/engine/engine_context.ts +16 -0
  251. package/src/engine/engine_gameobject.ts +73 -0
  252. package/src/engine/engine_input.ts +83 -7
  253. package/src/engine/engine_loaders.ts +9 -2
  254. package/src/engine/engine_math.ts +81 -2
  255. package/src/engine/engine_modules.ts +24 -0
  256. package/src/engine/engine_networking.ts +187 -17
  257. package/src/engine/engine_networking_auto.ts +36 -9
  258. package/src/engine/engine_physics.ts +37 -1
  259. package/src/engine/engine_physics_rapier.ts +77 -0
  260. package/src/engine/engine_serialization_decorator.ts +28 -2
  261. package/src/engine/engine_time.ts +23 -3
  262. package/src/engine/engine_util_decorator.ts +31 -1
  263. package/src/engine/engine_utils.ts +21 -5
  264. package/src/engine/engine_utils_format.ts +6 -2
  265. package/src/engine/extensions/NEEDLE_materialx.ts +143 -0
  266. package/src/engine/extensions/extensions.ts +2 -0
  267. package/src/engine/extensions/index.ts +1 -0
  268. package/src/engine-components/AlignmentConstraint.ts +24 -4
  269. package/src/engine-components/Animation.ts +44 -2
  270. package/src/engine-components/Animator.ts +40 -7
  271. package/src/engine-components/AudioSource.ts +37 -15
  272. package/src/engine-components/AxesHelper.ts +23 -4
  273. package/src/engine-components/BasicIKConstraint.ts +28 -5
  274. package/src/engine-components/Camera.ts +33 -3
  275. package/src/engine-components/CharacterController.ts +73 -6
  276. package/src/engine-components/Collider.ts +78 -21
  277. package/src/engine-components/ContactShadows.ts +51 -11
  278. package/src/engine-components/DeleteBox.ts +43 -2
  279. package/src/engine-components/DeviceFlag.ts +22 -3
  280. package/src/engine-components/DragControls.ts +32 -2
  281. package/src/engine-components/DropListener.ts +42 -29
  282. package/src/engine-components/Duplicatable.ts +37 -6
  283. package/src/engine-components/EventList.ts +41 -13
  284. package/src/engine-components/Fog.ts +23 -1
  285. package/src/engine-components/GridHelper.ts +18 -2
  286. package/src/engine-components/GroundProjection.ts +25 -3
  287. package/src/engine-components/Interactable.ts +17 -2
  288. package/src/engine-components/Joints.ts +51 -8
  289. package/src/engine-components/LODGroup.ts +45 -11
  290. package/src/engine-components/Light.ts +30 -8
  291. package/src/engine-components/LookAtConstraint.ts +26 -8
  292. package/src/engine-components/NeedleMenu.ts +29 -7
  293. package/src/engine-components/NestedGltf.ts +40 -4
  294. package/src/engine-components/OffsetConstraint.ts +27 -3
  295. package/src/engine-components/OrbitControls.ts +41 -3
  296. package/src/engine-components/ReflectionProbe.ts +31 -13
  297. package/src/engine-components/Renderer.ts +34 -1
  298. package/src/engine-components/SceneSwitcher.ts +11 -0
  299. package/src/engine-components/ScreenCapture.ts +41 -9
  300. package/src/engine-components/Skybox.ts +1 -1
  301. package/src/engine-components/SmoothFollow.ts +69 -7
  302. package/src/engine-components/SpatialTrigger.ts +51 -4
  303. package/src/engine-components/SpectatorCamera.ts +23 -5
  304. package/src/engine-components/SyncedRoom.ts +6 -0
  305. package/src/engine-components/SyncedTransform.ts +59 -10
  306. package/src/engine-components/TransformGizmo.ts +31 -4
  307. package/src/engine-components/VideoPlayer.ts +48 -6
  308. package/src/engine-components/Voip.ts +33 -2
  309. package/src/engine-components/export/usdz/USDZExporter.ts +47 -13
  310. package/src/engine-components/particlesystem/ParticleSystem.ts +84 -5
  311. package/src/engine-components/timeline/PlayableDirector.ts +104 -27
  312. package/src/engine-components/ui/Button.ts +29 -3
  313. package/src/engine-components/ui/Canvas.ts +28 -3
  314. package/src/engine-components/ui/Image.ts +22 -3
  315. package/src/engine-components/ui/Raycaster.ts +57 -8
  316. package/src/engine-components/ui/Text.ts +24 -2
  317. package/src/engine-components/webxr/TeleportTarget.ts +23 -4
  318. package/src/engine-components/webxr/WebXR.ts +11 -3
  319. package/src/engine-components/webxr/WebXRAvatar.ts +41 -4
  320. package/src/engine-components/webxr/WebXRImageTracking.ts +282 -38
  321. package/src/engine-components/webxr/XRFlag.ts +30 -3
  322. package/plugins/vite/materialx.js +0 -32
@@ -8,26 +8,62 @@ import { EventList } from "./EventList.js";
8
8
 
9
9
  const debug = getParam("debugnestedgltf");
10
10
 
11
- /** The nested gltf is a component that is used to load a gltf file when the component becomes active (start)
12
- * It will load the gltf file and instantiate it as a child of the parent of the GameObject that has this component
11
+ /**
12
+ * NestedGltf loads and instantiates a glTF file when the component starts.
13
+ * NestedGltf components are created by the Unity exporter when nesting Objects with the GltfObject component (in Unity).
14
+ * Use this for lazy-loading content, modular scene composition, or dynamic asset loading.
13
15
  *
16
+ * ![](https://cloud.needle.tools/-/media/lJKrr_2tWlqRFdFc46U4bQ.gif)
17
+ *
18
+ * The loaded glTF is instantiated as a sibling (child of parent) by default,
19
+ * inheriting the transform of the GameObject with this component.
20
+ *
21
+ * **Features:**
22
+ * - Automatic loading on start
23
+ * - Progress callbacks for loading UI
24
+ * - Preloading support for faster display
25
+ * - Event callback when loading completes
26
+ *
27
+ * @example Load a glTF when object becomes active
28
+ * ```ts
29
+ * const nested = myPlaceholder.addComponent(NestedGltf);
30
+ * nested.filePath = new AssetReference("models/furniture.glb");
31
+ * nested.loaded.addEventListener(({ instance }) => {
32
+ * console.log("Loaded:", instance.name);
33
+ * });
34
+ * ```
35
+ *
36
+ * @example Preload for instant display
37
+ * ```ts
38
+ * // Preload during loading screen
39
+ * await nested.preload();
40
+ * // Later, when object becomes active, it displays instantly
41
+ * ```
42
+ *
14
43
  * @summary Loads and instantiates a nested glTF file
15
44
  * @category Asset Management
16
45
  * @group Components
46
+ * @see {@link AssetReference} for asset loading utilities
47
+ * @see {@link SceneSwitcher} for scene-level loading
48
+ * @link https://engine.needle.tools/samples/hotspots
17
49
  */
18
50
  export class NestedGltf extends Behaviour {
19
51
 
20
- /** A reference to the gltf file that should be loaded */
52
+ /** Reference to the glTF file to load. Can be a URL or asset path. */
21
53
  @serializable(AssetReference)
22
54
  filePath?: AssetReference;
23
55
 
24
- /** Invoked when the nested glTF file has been instantiated */
56
+ /**
57
+ * Event fired when the glTF has been loaded and instantiated.
58
+ * Provides the component, loaded instance, and asset reference.
59
+ */
25
60
  @serializable(EventList)
26
61
  loaded: EventList<{ component: NestedGltf, instance: any, asset: AssetReference }> = new EventList();
27
62
 
28
63
  /**
29
64
  * EXPERIMENTAL for cloud asset loading
30
65
  */
66
+ @serializable()
31
67
  loadAssetInParent = true;
32
68
 
33
69
 
@@ -5,11 +5,35 @@ import * as utils from "./../engine/engine_three_utils.js";
5
5
  import { Behaviour, GameObject } from "./Component.js";
6
6
 
7
7
  /**
8
- * OffsetConstraint component allows an object to maintain a specified positional and rotational offset
9
- * relative to another object, with options for alignment and leveling.
10
- * @summary Maintains positional and rotational offset relative to another object
8
+ * OffsetConstraint maintains a fixed positional and rotational offset relative to a target object.
9
+ * Useful for attaching objects to moving targets while preserving a specific spatial relationship.
10
+ *
11
+ * **Use cases:**
12
+ * - Camera following a player with offset
13
+ * - UI elements attached to characters
14
+ * - Weapons attached to hands
15
+ * - Objects orbiting around a target
16
+ *
17
+ * **Options:**
18
+ * - `affectPosition` - Apply position offset
19
+ * - `affectRotation` - Apply rotation offset
20
+ * - `alignLookDirection` - Make object face same direction as target
21
+ * - `levelLookDirection` - Keep look direction horizontal (ignore pitch)
22
+ * - `levelPosition` - Project position onto horizontal plane
23
+ * - `referenceSpace` - Transform offset in this object's coordinate space
24
+ *
25
+ * @example Attach camera offset to player
26
+ * ```ts
27
+ * const constraint = camera.addComponent(OffsetConstraint);
28
+ * // Configure via serialized properties in editor
29
+ * ```
30
+ *
31
+ * @summary Maintains positional/rotational offset relative to target
11
32
  * @category Constraints
12
33
  * @group Components
34
+ * @see {@link SmoothFollow} for smoothed following
35
+ * @see {@link LookAtConstraint} for aim constraints
36
+ * @see {@link AlignmentConstraint} for alignment between two objects
13
37
  */
14
38
  export class OffsetConstraint extends Behaviour {
15
39
 
@@ -60,12 +60,50 @@ declare module 'three/examples/jsm/controls/OrbitControls.js' {
60
60
  }
61
61
  }
62
62
 
63
- /** The OrbitControls component is used to control a camera using the [OrbitControls from three.js](https://threejs.org/docs/#examples/en/controls/OrbitControls) library.
64
- * The three OrbitControls object can be accessed via the `controls` property.
65
- * The object being controlled by the OrbitControls (usually the camera) can be accessed via the `controllerObject` property.
63
+ /**
64
+ * OrbitControls provides interactive camera control using three.js OrbitControls.
65
+ * Users can rotate, pan, and zoom the camera to explore 3D scenes.
66
+ *
67
+ * **Features:**
68
+ * - Rotation around a target point (orbit)
69
+ * - Panning to move the view
70
+ * - Zooming via scroll or pinch
71
+ * - Auto-rotation for showcases
72
+ * - Configurable angle and distance limits
73
+ * - Smooth damping for natural feel
74
+ *
75
+ * ![](https://cloud.needle.tools/-/media/ylC34hrC3srwyzGNhFRbEQ.gif)
76
+ *
77
+ * **Access underlying controls:**
78
+ * - `controls` - The three.js OrbitControls instance
79
+ * - `controllerObject` - The object being controlled (usually the camera)
80
+ *
81
+ * **Debug options:**
82
+ * - `?debugorbit` - Log orbit control events
83
+ * - `?freecam` - Enable unrestricted camera movement
84
+ *
85
+ * @example Basic setup
86
+ * ```ts
87
+ * const orbitControls = camera.getComponent(OrbitControls);
88
+ * orbitControls.autoRotate = true;
89
+ * orbitControls.autoRotateSpeed = 2;
90
+ * ```
91
+ *
92
+ * @example Set look-at target
93
+ * ```ts
94
+ * orbitControls.setLookTargetPosition(new Vector3(0, 1, 0), true);
95
+ * // Or move both camera and target
96
+ * orbitControls.setCameraTargetPosition(new Vector3(5, 2, 5), new Vector3(0, 0, 0));
97
+ * ```
98
+ *
66
99
  * @summary Camera controller using three.js OrbitControls
67
100
  * @category Camera and Controls
68
101
  * @group Components
102
+ * @see {@link LookAtConstraint} for setting the look-at target
103
+ * @see {@link SmoothFollow} for smooth camera following
104
+ * @see {@link Camera} for camera configuration
105
+ * @link https://threejs.org/docs/#examples/en/controls/OrbitControls
106
+ * @link https://engine.needle.tools/samples/panorama-controls alternative controls in samples
69
107
  */
70
108
  export class OrbitControls extends Behaviour implements ICameraController {
71
109
 
@@ -15,13 +15,28 @@ const $reflectionProbeKey = Symbol("reflectionProbeKey");
15
15
  const $originalMaterial = Symbol("original material");
16
16
 
17
17
  /**
18
- * A ReflectionProbe provides reflection data to materials within its defined area.
19
- *
20
- * - Sample: http://samples.needle.tools/reflection-probes
21
- *
18
+ * ReflectionProbe provides environment reflection data to materials within its defined area.
19
+ * Use for chrome-like materials that need accurate environment reflections.
20
+ *
21
+ * **Setup:**
22
+ * 1. Add ReflectionProbe component to an object
23
+ * 2. Assign a cubemap or HDR texture
24
+ * 3. In Renderer components, assign the probe as anchor override
25
+ *
26
+ * **Note:** Volume-based automatic assignment is not fully supported yet.
27
+ * Objects (Renderer components) can explicitly reference their reflection probe.
28
+ *
29
+ * **Debug options:**
30
+ * - `?debugreflectionprobe` - Log probe info
31
+ * - `?noreflectionprobe` - Disable all reflection probes
32
+ *
33
+ * - Example: https://engine.needle.tools/samples/reflection-probes
34
+ *
22
35
  * @summary Provides reflection data to materials
23
36
  * @category Rendering
24
37
  * @group Components
38
+ * @see {@link Renderer} for material and rendering control
39
+ * @see {@link Light} for scene lighting
25
40
  */
26
41
  export class ReflectionProbe extends Behaviour {
27
42
 
@@ -45,7 +60,6 @@ export class ReflectionProbe extends Behaviour {
45
60
  return probe;
46
61
  }
47
62
  }
48
- // TODO not supported right now, as we'd have to pass the ReflectionProbe scale through as well.
49
63
  else if (probe.isInBox(object)) {
50
64
  if (debug) console.log("Found reflection probe", object.name, probe.name);
51
65
  return probe;
@@ -137,7 +151,7 @@ export class ReflectionProbe extends Behaviour {
137
151
  // and some need reflection probe and some don't
138
152
  // we need to make sure we don't override the material but use a copy
139
153
 
140
- private static _rendererMaterialsCache: Map<IRenderer, Array<{ material: Material, copy: Material }>> = new Map();
154
+ private static _rendererMaterialsCache: Map<IRenderer, Array<{ material: Material, copy: Material, originalVersion: number }>> = new Map();
141
155
 
142
156
  onSet(_rend: IRenderer) {
143
157
  if (disable) return;
@@ -171,15 +185,16 @@ export class ReflectionProbe extends Behaviour {
171
185
  let cached = rendererCache[i];
172
186
 
173
187
  // make sure we have the currently assigned material cached (and an up to date clone of that)
174
- // TODO: this is causing problems with progressive textures sometimes (depending on the order) when the version changes and we re-create materials over and over. We might want to just set the material envmap instead of making a clone
188
+ // Compare against the stored original version, not the clone's version (which gets modified by needsUpdate)
189
+ // This prevents cloning materials every frame when onUnset restores the original material
175
190
  const isCachedInstance = material === cached?.copy;
176
- const hasChanged = !cached || cached.material.uuid !== material.uuid || cached.copy.version !== material.version;
191
+ const hasChanged = !cached || cached.material.uuid !== material.uuid || cached.originalVersion !== material.version;
177
192
  if (!isCachedInstance && hasChanged) {
178
193
  if (debug) {
179
194
  let reason = "";
180
195
  if (!cached) reason = "not cached";
181
196
  else if (cached.material !== material) reason = "reference changed; cached instance?: " + isCachedInstance;
182
- else if (cached.copy.version !== material.version) reason = "version changed";
197
+ else if (cached.originalVersion !== material.version) reason = "version changed";
183
198
  console.warn("Cloning material", material.name, material.version, "Reason:", reason, "\n", material.uuid, "\n", cached?.copy.uuid, "\n", _rend.name);
184
199
  }
185
200
 
@@ -189,11 +204,13 @@ export class ReflectionProbe extends Behaviour {
189
204
  if (cached) {
190
205
  cached.copy = clone;
191
206
  cached.material = material;
207
+ cached.originalVersion = material.version;
192
208
  }
193
209
  else {
194
210
  cached = {
195
211
  material: material,
196
- copy: clone
212
+ copy: clone,
213
+ originalVersion: material.version
197
214
  };
198
215
  rendererCache.push(cached);
199
216
  }
@@ -213,9 +230,10 @@ export class ReflectionProbe extends Behaviour {
213
230
  const copy = cached?.copy;
214
231
 
215
232
  if ("envMap" in copy) {
216
- // make sure the reflection probe is assigned
217
- copy.envMap = this.texture;
218
- copy.needsUpdate = true;
233
+ if (copy.envMap !== this.texture) { // Only update if changed
234
+ copy.envMap = this.texture;
235
+ copy.needsUpdate = true;
236
+ }
219
237
  }
220
238
 
221
239
  _rend.sharedMaterials[i] = copy;
@@ -200,8 +200,42 @@ class SharedMaterialArray implements ISharedMaterials {
200
200
  }
201
201
 
202
202
  /**
203
+ * Renderer controls rendering properties of meshes including materials,
204
+ * lightmaps, reflection probes, and GPU instancing.
205
+ *
206
+ * **Materials:**
207
+ * Access materials via `sharedMaterials` array. Changes affect all instances.
208
+ * Use material cloning for per-instance variations.
209
+ *
210
+ * **Instancing:**
211
+ * Enable GPU instancing for improved performance with many identical objects.
212
+ * Use `Renderer.setInstanced(obj, true)` or `enableInstancing` property.
213
+ *
214
+ * **Lightmaps:**
215
+ * Baked lighting is automatically applied when exported from Unity.
216
+ * Access via the associated {@link RendererLightmap} component.
217
+ *
218
+ * **Debug options:**
219
+ * - `?debugrenderer` - Log renderer info
220
+ * - `?wireframe` - Show wireframe rendering
221
+ * - `?noinstancing` - Disable GPU instancing
222
+ *
223
+ * @example Change material at runtime
224
+ * ```ts
225
+ * const renderer = myObject.getComponent(Renderer);
226
+ * renderer.sharedMaterials[0] = newMaterial;
227
+ * ```
228
+ *
229
+ * @example Enable instancing
230
+ * ```ts
231
+ * Renderer.setInstanced(myObject, true);
232
+ * ```
233
+ *
203
234
  * @category Rendering
204
235
  * @group Components
236
+ * @see {@link ReflectionProbe} for environment reflections
237
+ * @see {@link Light} for scene lighting
238
+ * @see {@link LODGroup} for level of detail
205
239
  */
206
240
  export class Renderer extends Behaviour implements IRenderer {
207
241
 
@@ -691,7 +725,6 @@ export class Renderer extends Behaviour implements IRenderer {
691
725
  }
692
726
 
693
727
  if (this.reflectionProbeUsage !== ReflectionProbeUsage.Off && this._reflectionProbe) {
694
- if (!this._lightmaps?.length) // Currently reflectionprobes cant be used with lightmaps
695
728
  this._reflectionProbe.onSet(this);
696
729
  }
697
730
  // since three 163 we need to set the envMap to the scene envMap if it is not set
@@ -84,6 +84,13 @@ export interface ISceneEventListener {
84
84
  * - [Needle Website](https://needle.tools)
85
85
  * - [Songs Of Cultures](https://app.songsofcultures.com)
86
86
  *
87
+ * ![](https://cloud.needle.tools/-/media/I-atrBcwIcg2kfvPl8c71A.gif)
88
+ * *Replace entire scenes with the SceneSwitcher.*
89
+ *
90
+ * ![](https://cloud.needle.tools/-/media/_FbH-7pkDmluTdfphXlP-A.gif)
91
+ * *Multiple SceneSwitcher components can be used at the same time and they can also be nested
92
+ * (a scene loaded by a SceneSwitcher can also have a SceneSwitcher to load sub-scenes).*
93
+ *
87
94
  * ### Interfaces
88
95
  * Use the {@link ISceneEventListener} interface to listen to scene open and closing events with the ability to modify transitions and stall the scene loading process.
89
96
  *
@@ -111,6 +118,10 @@ export interface ISceneEventListener {
111
118
  * @summary Dynamically loads and switches between multiple scenes
112
119
  * @category Asset Management
113
120
  * @group Components
121
+ * @see {@link ISceneEventListener} for scene transition callbacks
122
+ * @see {@link AssetReference} for loading individual assets
123
+ * @see {@link NestedGltf} for embedding static glTF content
124
+ * @link https://engine.needle.tools/docs/how-to-guides/components/scene-switcher.html
114
125
  */
115
126
  export class SceneSwitcher extends Behaviour {
116
127
 
@@ -61,19 +61,51 @@ export declare type ScreenCaptureOptions = {
61
61
  deviceFilter?: (device: MediaDeviceInfo) => boolean,
62
62
  }
63
63
 
64
- /**
65
- * The ScreenCapture component allows you to share your screen, camera or microphone with other users in the networked room.
66
- * When the stream is active the video will be displayed on the VideoPlayer component attached to the same GameObject.
67
- *
68
- * Note: For debugging append `?debugscreensharing` to the URL to see more information in the console.
69
- *
70
- * By default the component will start sharing the screen when the user clicks on the object this component is attached to. You can set {@link device} This behaviour can be disabled by setting `allowStartOnClick` to false.
71
- * It is also possible to start the stream manually from your code by calling the {@link share} method.
64
+ /**
65
+ * ScreenCapture enables sharing screen, camera, or microphone with users in a networked room.
66
+ * The stream is displayed via a {@link VideoPlayer} component on the same GameObject.
67
+ *
68
+ * **Supported capture devices:**
69
+ * - `Screen` - Share desktop/window/tab
70
+ * - `Camera` - Share webcam feed
71
+ * - `Microphone` - Audio only
72
+ * - `Canvas` - Share the 3D canvas (experimental)
72
73
  *
74
+ * ![](https://cloud.needle.tools/-/media/Ugw6sKj3KNeLMzl0yKQXig.gif)
75
+ *
76
+ * **How it works:**
77
+ * - Click the object to start/stop sharing (if `allowStartOnClick` is true)
78
+ * - Or call `share()` / `close()` programmatically
79
+ * - Stream is sent to all users in the same room via WebRTC
80
+ * - Receiving clients see the video on their VideoPlayer
81
+ *
82
+ * **Debug:** Append `?debugscreensharing` to the URL for console logging.
83
+ *
84
+ * @example Start screen sharing programmatically
85
+ * ```ts
86
+ * const capture = myScreen.getComponent(ScreenCapture);
87
+ * await capture?.share({ device: "Screen" });
88
+ *
89
+ * // Later, stop sharing
90
+ * capture?.close();
91
+ * ```
92
+ *
93
+ * @example Share webcam with constraints
94
+ * ```ts
95
+ * await capture?.share({
96
+ * device: "Camera",
97
+ * constraints: { width: 1280, height: 720 }
98
+ * });
99
+ * ```
100
+ *
73
101
  * @summary Share screen, camera or microphone in a networked room
74
102
  * @category Networking
75
103
  * @group Components
76
- */
104
+ * @see {@link VideoPlayer} for displaying the received stream
105
+ * @see {@link Voip} for voice-only communication
106
+ * @see {@link SyncedRoom} for room management
107
+ * @link https://engine.needle.tools/docs/networking.html
108
+ */
77
109
  export class ScreenCapture extends Behaviour implements IPointerClickHandler {
78
110
 
79
111
  /**
@@ -443,7 +443,7 @@ function tryParseMagicSkyboxName(str: string | null | undefined, environment: bo
443
443
  return useLowRes ? value.url_low : value.url;
444
444
  }
445
445
  else if (typeof str === "string" && str?.length && (isDevEnvironment() || debug)) {
446
- const noUrlOrFile = !str.startsWith("http") && !str.startsWith("file:") && !str.startsWith("blob:") && !str.startsWith("data:");
446
+ const noUrlOrFile = !str.startsWith("http") && !str.startsWith("file:") && !str.startsWith("blob:") && !str.startsWith("data:") && !str.startsWith("/")
447
447
  if(noUrlOrFile) {
448
448
  console.warn(`RemoteSkybox: Unknown magic skybox name "${str}". Valid names are: ${Object.keys(MagicSkyboxNames).map(n => `"${n}"`).join(", ")}`);
449
449
  }
@@ -6,12 +6,57 @@ import { serializable } from "../engine/engine_serialization_decorator.js";
6
6
  import { getWorldPosition, getWorldQuaternion } from "../engine/engine_three_utils.js";
7
7
  import { Behaviour } from "./Component.js";
8
8
 
9
+ import type { LookAt } from "./api.js";
10
+
9
11
  /**
10
- * SmoothFollow makes the {@link Object3D} (`GameObject`) smoothly follow another target {@link Object3D}.
11
- * It can follow the target's position, rotation, or both.
12
- * @summary Smoothly follows a target object
12
+ * SmoothFollow makes this GameObject smoothly follow another target object's position and/or rotation.
13
+ *
14
+ * **Position Following:**
15
+ * When enabled (`followFactor > 0`), this object will move towards the target's world position.
16
+ * The object interpolates from its current position to the target's position each frame.
17
+ * Use `positionAxes` to restrict following to specific axes (e.g., only horizontal movement).
18
+ *
19
+ * **Rotation Following:**
20
+ * When enabled (`rotateFactor > 0`), this object will rotate to match the target's world rotation.
21
+ * The object smoothly interpolates from its current rotation to the target's rotation each frame.
22
+ * This makes the object face the same direction as the target, not look at it (use {@link LookAt} for that).
23
+ *
24
+ * **Smoothing:**
25
+ * Both position and rotation use time-based interpolation (lerp/slerp).
26
+ * Higher factor values = faster following (less lag), lower values = slower following (more lag).
27
+ * Set a factor to 0 to disable that type of following entirely.
28
+ *
29
+ * **Common Use Cases:**
30
+ * - Camera following a player character
31
+ * - UI elements tracking world objects
32
+ * - Delayed motion effects (ghost trails, spring arms)
33
+ * - Smoothed object attachment
34
+ *
35
+ * @example Follow a target with smooth position
36
+ * ```ts
37
+ * const follower = myObject.addComponent(SmoothFollow);
38
+ * follower.target = playerObject;
39
+ * follower.followFactor = 5; // Higher = faster following
40
+ * follower.rotateFactor = 0; // Don't follow rotation
41
+ * ```
42
+ *
43
+ * @example Follow only on horizontal plane
44
+ * ```ts
45
+ * follower.positionAxes = Axes.X | Axes.Z; // Follow X and Z only (no vertical)
46
+ * ```
47
+ *
48
+ * @example Follow both position and rotation
49
+ * ```ts
50
+ * follower.target = targetObject;
51
+ * follower.followFactor = 3; // Smooth position following
52
+ * follower.rotateFactor = 2; // Smooth rotation following
53
+ * ```
54
+ *
55
+ * @summary Smoothly follows a target object's position and/or rotation
13
56
  * @category Interactivity
14
57
  * @group Components
58
+ * @see {@link LookAtConstraint} for making an object look at a target (different from rotation following)
59
+ * @see {@link Mathf} for the interpolation used
15
60
  */
16
61
  export class SmoothFollow extends Behaviour {
17
62
 
@@ -22,21 +67,34 @@ export class SmoothFollow extends Behaviour {
22
67
  target: Object3D | null = null;
23
68
 
24
69
  /**
25
- * The factor to smoothly follow the target's position.
26
- * The value is clamped between 0 and 1. If 0, the GameObject will not follow the target's position.
70
+ * Speed factor for position following.
71
+ * Controls how quickly this object moves to match the target's position.
72
+ * Higher values = faster/tighter following (less lag), lower = slower/looser (more lag).
73
+ * Set to 0 to disable position following entirely.
74
+ * @default 0.1
27
75
  */
28
76
  @serializable()
29
77
  followFactor = .1;
78
+
30
79
  /**
31
- * The factor to smoothly follow the target's rotation.
32
- * The value is clamped between 0 and 1. If 0, the GameObject will not follow the target's rotation.
80
+ * Speed factor for rotation following.
81
+ * Controls how quickly this object rotates to match the target's rotation.
82
+ * Higher values = faster/tighter following (less lag), lower = slower/looser (more lag).
83
+ * Set to 0 to disable rotation following entirely.
84
+ * @default 0.1
33
85
  */
34
86
  @serializable()
35
87
  rotateFactor = .1;
36
88
 
89
+ /**
90
+ * Which position axes to follow. Use bitwise OR to combine:
91
+ * `Axes.X | Axes.Y` follows only X and Y axes.
92
+ * @default Axes.All
93
+ */
37
94
  @serializable()
38
95
  positionAxes: Axes = Axes.All;
39
96
 
97
+ /** When true, rotates 180° around Y axis (useful for mirrored setups) */
40
98
  flipForward: boolean = false;
41
99
 
42
100
  private static _invertForward: Quaternion = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI);
@@ -49,6 +107,10 @@ export class SmoothFollow extends Behaviour {
49
107
  this.updateNow(false);
50
108
  }
51
109
 
110
+ /**
111
+ * Manually update the position/rotation to follow the target.
112
+ * @param hard If true, snaps instantly to target without smoothing
113
+ */
52
114
  updateNow(hard: boolean) {
53
115
  if (!this.target || this.target === this.gameObject) return;
54
116
  if (this.followFactor > 0) {
@@ -24,11 +24,34 @@ function testMask(mask1, mask2) {
24
24
  }
25
25
 
26
26
  /**
27
- * Component that receives and responds to spatial events, like entering or exiting a trigger zone.
28
- * Used in conjunction with {@link SpatialTrigger} to create interactive spatial events.
27
+ * Component that receives and responds to spatial events, like entering or exiting a trigger zone.
28
+ * Used in conjunction with {@link SpatialTrigger} to create interactive spatial events.
29
+ *
30
+ * Place this on objects that should react when entering trigger zones. The receiver checks
31
+ * against all active SpatialTriggers each frame and fires events when intersections change.
32
+ *
33
+ * Events can be connected via {@link EventList} in the editor or listened to in code.
34
+ *
35
+ * @example Listen to trigger events
36
+ * ```ts
37
+ * export class DoorTrigger extends Behaviour {
38
+ * @serializable(SpatialTriggerReceiver)
39
+ * receiver?: SpatialTriggerReceiver;
40
+ *
41
+ * start() {
42
+ * this.receiver?.onEnter?.addEventListener(() => {
43
+ * console.log("Player entered door zone");
44
+ * });
45
+ * }
46
+ * }
47
+ * ```
48
+ *
29
49
  * @summary Receives spatial trigger events
30
50
  * @category Interactivity
31
51
  * @group Components
52
+ * @see {@link SpatialTrigger} for defining trigger zones
53
+ * @see {@link EventList} for event handling
54
+ * @link https://engine.needle.tools/samples/spatial-triggers/
32
55
  */
33
56
  export class SpatialTriggerReceiver extends Behaviour {
34
57
 
@@ -126,10 +149,34 @@ export class SpatialTriggerReceiver extends Behaviour {
126
149
  }
127
150
 
128
151
  /**
129
- * A spatial trigger component that detects objects within a box-shaped area.
130
- * Used to trigger events when objects enter, stay in, or exit the defined area
152
+ * A spatial trigger component that detects objects within a box-shaped area.
153
+ * Used to trigger events when objects enter, stay in, or exit the defined area.
154
+ *
155
+ * The trigger area is defined by the GameObject's bounding box (uses {@link BoxHelperComponent}).
156
+ * Objects with {@link SpatialTriggerReceiver} components are tested against this area.
157
+ *
158
+ * **Mask system:** Both trigger and receiver have a `triggerMask` - they only interact
159
+ * when their masks have overlapping bits set. This allows selective triggering.
160
+ *
161
+ * **Debug:** Use `?debugspatialtrigger` URL parameter to visualize trigger zones.
162
+ *
163
+ * @example Create a pickup zone
164
+ * ```ts
165
+ * // On the pickup zone object
166
+ * const trigger = pickupZone.addComponent(SpatialTrigger);
167
+ * trigger.triggerMask = 1; // Layer 1 for pickups
168
+ *
169
+ * // On the player
170
+ * const receiver = player.addComponent(SpatialTriggerReceiver);
171
+ * receiver.triggerMask = 1; // Match the pickup layer
172
+ * ```
173
+ *
174
+ * @summary Define a trigger zone that detects entering objects
131
175
  * @category Interactivity
132
176
  * @group Components
177
+ * @see {@link SpatialTriggerReceiver} for objects that respond to triggers
178
+ * @see {@link BoxHelperComponent} for the underlying box used to define the trigger area
179
+ * @link https://engine.needle.tools/samples/spatial-triggers/
133
180
  */
134
181
  export class SpatialTrigger extends Behaviour {
135
182
 
@@ -31,14 +31,32 @@ export enum SpectatorMode {
31
31
  const debug = getParam("debugspectator");
32
32
 
33
33
  /**
34
- * Provides functionality to follow and spectate other users in a networked environment.
35
- * Handles camera switching, following behavior, and network synchronization for spectator mode.
36
- *
37
- * Debug mode can be enabled with the URL parameter `?debugspectator`, which provides additional console output.
38
- *
34
+ * SpectatorCamera enables following and spectating other users in networked sessions.
35
+ * Switch between first-person (see what they see) and third-person (orbit around them) views.
36
+ *
37
+ * **Keyboard controls** (when `useKeys = true`):
38
+ * - `F` - Request all users to follow the local player
39
+ * - `ESC` - Stop spectating
40
+ *
41
+ * **Spectator modes:**
42
+ * - `FirstPerson` - View from the followed player's perspective
43
+ * - `ThirdPerson` - Freely orbit around the followed player
44
+ *
45
+ * **Debug:** Use `?debugspectator` URL parameter for logging.
46
+ *
47
+ * @example Start spectating a user
48
+ * ```ts
49
+ * const spectator = camera.getComponent(SpectatorCamera);
50
+ * spectator.follow(targetUserId);
51
+ * spectator.mode = SpectatorMode.ThirdPerson;
52
+ * ```
53
+ *
39
54
  * @summary Spectator camera for following other users
40
55
  * @category Networking
41
56
  * @group Components
57
+ * @see {@link SpectatorMode} for view options
58
+ * @see {@link SyncedRoom} for networked sessions
59
+ * @see {@link OrbitControls} for third-person orbit
42
60
  */
43
61
  export class SpectatorCamera extends Behaviour {
44
62
 
@@ -33,9 +33,15 @@ const debug = utils.getParam("debugsyncedroom");
33
33
  * myObject.addComponent(SyncedRoom, { joinRandomRoom: true, roomPrefix: "myApp_" });
34
34
  * ```
35
35
  *
36
+ * **Debug:** Use `?debugsyncedroom` URL parameter for logging.
37
+ *
36
38
  * @summary Joins a networked room based on URL parameters or a random room
37
39
  * @category Networking
38
40
  * @group Components
41
+ * @see {@link SyncedTransform} for synchronizing object transforms
42
+ * @see {@link Voip} for voice communication in rooms
43
+ * @see {@link ScreenCapture} for screen/video sharing
44
+ * @link https://engine.needle.tools/docs/networking.html
39
45
  */
40
46
  export class SyncedRoom extends Behaviour {
41
47