@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
@@ -1,10 +1,81 @@
1
1
  import { Behaviour } from "../Component.js";
2
2
  /**
3
- * The CursorFollow component makes the object follow the cursor (or touch) position on screen.
3
+ * [CursorFollow](https://engine.needle.tools/docs/api/CursorFollow) makes an object smoothly follow the cursor or touch position in 3D space.
4
+ * The component tracks pointer movement and updates the object's position to follow it, with optional damping for smooth motion.
4
5
  *
5
- * - Example: [Look At Cursor sample](https://engine.needle.tools/samples/look-at-cursor-interactive-3d-header/). This sample combines the CursorFollow component with a LookAt component to create an interactive 3D header that looks at the cursor.
6
+ * ![](https://cloud.needle.tools/-/media/GDspQGC_kB85Bc9IyEtr9Q.gif)
6
7
  *
7
- * @summary Makes the object follow the cursor position on screen
8
+ * **How It Works:**
9
+ * The component creates a ray from the camera through the cursor position and places the object along that ray.
10
+ * By default, it maintains the object's initial distance from the camera, creating a natural cursor-following effect
11
+ * that works consistently regardless of camera movement.
12
+ *
13
+ * **Key Features:**
14
+ * - Smooth cursor following with configurable damping
15
+ * - Works with both mouse and touch input
16
+ * - Can follow cursor across the entire page or just within the canvas
17
+ * - Maintains consistent distance from camera by default
18
+ * - Optional surface snapping using raycasts
19
+ * - Responds to camera movement automatically
20
+ *
21
+ * **Common Use Cases:**
22
+ * - Interactive 3D cursors or pointers
23
+ * - Look-at effects combined with {@link LookAtConstraint}
24
+ * - Floating UI elements that track cursor
25
+ * - Interactive product showcases
26
+ * - 3D header effects and hero sections
27
+ * - Virtual laser pointers in XR experiences
28
+ *
29
+ * @example Basic cursor follow with smooth damping
30
+ * ```ts
31
+ * const follower = new Object3D();
32
+ * follower.position.set(0, 0, -5); // Initial position 5 units from camera
33
+ * follower.addComponent(CursorFollow, {
34
+ * damping: 0.2, // Smooth following with 200ms damping
35
+ * keepDistance: true, // Maintain initial distance
36
+ * useFullPage: true // Track cursor across entire page
37
+ * });
38
+ * scene.add(follower);
39
+ * ```
40
+ *
41
+ * @example Surface-snapping cursor with raycast
42
+ * ```ts
43
+ * const cursor = new Object3D();
44
+ * cursor.addComponent(CursorFollow, {
45
+ * snapToSurface: true, // Snap to surfaces in the scene
46
+ * keepDistance: false, // Don't maintain distance when snapping
47
+ * damping: 0.1 // Quick, responsive movement
48
+ * });
49
+ * scene.add(cursor);
50
+ * ```
51
+ *
52
+ * @example Instant cursor following (no damping)
53
+ * ```ts
54
+ * gameObject.addComponent(CursorFollow, {
55
+ * damping: 0, // Instant movement
56
+ * useFullPage: false // Only track within canvas
57
+ * });
58
+ * ```
59
+ *
60
+ * @example Interactive 3D header that looks at cursor
61
+ * ```ts
62
+ * const character = loadModel("character.glb");
63
+ * const lookTarget = new Object3D();
64
+ * lookTarget.addComponent(CursorFollow, { damping: 0.3 });
65
+ * character.addComponent(LookAtConstraint, { target: lookTarget });
66
+ * scene.add(lookTarget, character);
67
+ * ```
68
+ *
69
+ * - Example: [Look At Cursor sample](https://engine.needle.tools/samples/look-at-cursor-interactive-3d-header/) - Combines CursorFollow with LookAt for an interactive 3D header
70
+ *
71
+ * @see {@link LookAtConstraint} - Commonly combined with CursorFollow for look-at effects
72
+ * @see {@link PointerEvents} - For more complex pointer interaction handling
73
+ * @see {@link DragControls} - For dragging objects in 3D space
74
+ * @see {@link OrbitControls} - For camera controls that work alongside CursorFollow
75
+ * @see {@link Context.input} - The input system that provides cursor position
76
+ * @see {@link Context.physics.raycastFromRay} - Used when snapToSurface is enabled
77
+ *
78
+ * @summary Makes objects follow the cursor/touch position in 3D space
8
79
  * @category Interactivity
9
80
  * @group Components
10
81
  * @component
@@ -12,25 +83,118 @@ import { Behaviour } from "../Component.js";
12
83
  export declare class CursorFollow extends Behaviour {
13
84
  static readonly NAME = "CursorFollow";
14
85
  /**
15
- * Damping for the movement, set to 0 for instant movement
86
+ * Damping factor controlling how smoothly the object follows the cursor (in seconds).
87
+ *
88
+ * This value determines the "lag" or smoothness of the following motion:
89
+ * - `0`: Instant movement, no damping (object snaps directly to cursor position)
90
+ * - `0.1-0.2`: Quick, responsive following with slight smoothing
91
+ * - `0.3-0.5`: Noticeable smooth trailing effect
92
+ * - `1.0+`: Slow, heavily damped movement
93
+ *
94
+ * The damping uses delta time, so the movement speed is framerate-independent and
95
+ * provides consistent behavior across different devices.
96
+ *
97
+ * **Tip:** For look-at effects, values between 0.2-0.4 typically feel most natural.
98
+ * For cursor indicators, 0.1 or less provides better responsiveness.
99
+ *
16
100
  * @default 0
17
101
  */
18
102
  damping: number;
19
103
  /**
20
- * When enabled the object will follow the cursor even outside of the needle-engine canvas. This is useful for example for look at effects where you have a small needle-engine element on your page and you want the 3D object to keep looking at the cursor even when it's outside of the canvas.
104
+ * Whether the object should track the cursor across the entire webpage or only within the canvas.
105
+ *
106
+ * **When `true` (default):**
107
+ * - The object follows the cursor anywhere on the page, even outside the canvas bounds
108
+ * - Perfect for look-at effects where you want continuous tracking
109
+ * - Great for embedded 3D elements that should feel aware of the whole page
110
+ * - Example: A 3D character in a hero section that watches the cursor as you scroll
111
+ *
112
+ * **When `false`:**
113
+ * - The object only follows the cursor when it's inside the Needle Engine canvas
114
+ * - Useful for contained experiences where the 3D element shouldn't react to external cursor movement
115
+ * - Better for multi-canvas scenarios or when you want isolated 3D interactions
116
+ *
117
+ * **Note:** When enabled, the component listens to `window.pointermove` events to track the
118
+ * full-page cursor position. When disabled, it uses the context's input system which is
119
+ * canvas-relative.
120
+ *
121
+ * @see {@link Context.input.mousePositionRC} for canvas-relative cursor position
21
122
  * @default true
22
123
  */
23
124
  useFullPage: boolean;
24
125
  /**
25
- * If true, the initial distance to the camera is maintained when following the cursor.
126
+ * Whether to maintain the object's initial distance from the camera while following the cursor.
127
+ *
128
+ * **When `true` (default):**
129
+ * - The object stays at a constant distance from the camera, moving in a spherical arc around it
130
+ * - Creates a natural "floating at cursor position" effect
131
+ * - The object's depth remains consistent as you move the cursor around
132
+ * - Perfect for cursors, pointers, or look-at targets
133
+ *
134
+ * **When `false`:**
135
+ * - The object's distance can change based on where the cursor projects in 3D space
136
+ * - More useful when combined with {@link snapToSurface} to follow surface geometry
137
+ * - Can create unusual depth behavior if not carefully configured
138
+ *
139
+ * **How it works:**
140
+ * On the first update, the component measures the distance from the object to the camera.
141
+ * This initial distance is then maintained throughout the object's lifetime (unless {@link updateDistance} is called).
142
+ * The object moves along a ray from the camera through the cursor, staying at this fixed distance.
143
+ *
144
+ * @see {@link updateDistance} to manually recalculate the distance
26
145
  * @default true
27
146
  */
28
147
  keepDistance: boolean;
29
148
  /**
30
- * If true, the object will attempt to snap to the surface of other objects in the scene using a raycast.
149
+ * When enabled, the object snaps to the surfaces of other objects in the scene using raycasting.
150
+ *
151
+ * **How it works:**
152
+ * After positioning the object at the cursor location, a raycast is performed backwards toward the camera.
153
+ * If the ray hits any surface, the object is moved to that hit point, effectively "snapping" to the surface.
154
+ *
155
+ * **Use cases:**
156
+ * - 3D paint or decal placement tools
157
+ * - Surface markers or waypoints
158
+ * - Interactive object placement in AR/VR
159
+ * - Cursor that follows terrain or mesh surfaces
160
+ *
161
+ * **Important notes:**
162
+ * - Requires objects in the scene to have colliders for raycasting to work
163
+ * - Works best with {@link keepDistance} set to `false` to allow depth changes
164
+ * - Can be combined with {@link damping} for smooth surface following
165
+ * - The raycast uses the physics system's raycast functionality
166
+ *
167
+ * **Debug mode:**
168
+ * Add `?debugcursor` to your URL to visualize the raycast hits with green debug lines.
169
+ *
170
+ * @see {@link Context.physics.raycastFromRay} for the underlying raycast implementation
171
+ * @see {@link keepDistance} should typically be false when using surface snapping
172
+ * @default false
31
173
  */
32
174
  snapToSurface: boolean;
33
175
  private _distance;
176
+ /**
177
+ * Manually recalculates the distance between the object and the camera.
178
+ *
179
+ * By default, the distance is calculated once when the component starts and then maintained
180
+ * when {@link keepDistance} is enabled. Use this method to update the reference distance
181
+ * if the camera or object has moved significantly.
182
+ *
183
+ * **Use cases:**
184
+ * - After teleporting the camera or object
185
+ * - When switching between different camera positions
186
+ * - After zoom operations that change the desired following distance
187
+ * - Dynamically adjusting the cursor's depth in response to user input
188
+ *
189
+ * @param force - If `true`, forces a recalculation even if {@link keepDistance} is enabled and distance was already set
190
+ *
191
+ * @example Recalculate distance after camera movement
192
+ * ```ts
193
+ * const cursorFollow = gameObject.getComponent(CursorFollow);
194
+ * camera.position.set(0, 0, 10); // Move camera
195
+ * cursorFollow?.updateDistance(true); // Update the reference distance
196
+ * ```
197
+ */
34
198
  updateDistance(force?: boolean): void;
35
199
  /** @internal */
36
200
  awake(): void;
@@ -12,11 +12,82 @@ import { getParam } from "../../engine/engine_utils.js";
12
12
  import { Behaviour } from "../Component.js";
13
13
  const debug = getParam("debugcursor");
14
14
  /**
15
- * The CursorFollow component makes the object follow the cursor (or touch) position on screen.
15
+ * [CursorFollow](https://engine.needle.tools/docs/api/CursorFollow) makes an object smoothly follow the cursor or touch position in 3D space.
16
+ * The component tracks pointer movement and updates the object's position to follow it, with optional damping for smooth motion.
16
17
  *
17
- * - Example: [Look At Cursor sample](https://engine.needle.tools/samples/look-at-cursor-interactive-3d-header/). This sample combines the CursorFollow component with a LookAt component to create an interactive 3D header that looks at the cursor.
18
+ * ![](https://cloud.needle.tools/-/media/GDspQGC_kB85Bc9IyEtr9Q.gif)
18
19
  *
19
- * @summary Makes the object follow the cursor position on screen
20
+ * **How It Works:**
21
+ * The component creates a ray from the camera through the cursor position and places the object along that ray.
22
+ * By default, it maintains the object's initial distance from the camera, creating a natural cursor-following effect
23
+ * that works consistently regardless of camera movement.
24
+ *
25
+ * **Key Features:**
26
+ * - Smooth cursor following with configurable damping
27
+ * - Works with both mouse and touch input
28
+ * - Can follow cursor across the entire page or just within the canvas
29
+ * - Maintains consistent distance from camera by default
30
+ * - Optional surface snapping using raycasts
31
+ * - Responds to camera movement automatically
32
+ *
33
+ * **Common Use Cases:**
34
+ * - Interactive 3D cursors or pointers
35
+ * - Look-at effects combined with {@link LookAtConstraint}
36
+ * - Floating UI elements that track cursor
37
+ * - Interactive product showcases
38
+ * - 3D header effects and hero sections
39
+ * - Virtual laser pointers in XR experiences
40
+ *
41
+ * @example Basic cursor follow with smooth damping
42
+ * ```ts
43
+ * const follower = new Object3D();
44
+ * follower.position.set(0, 0, -5); // Initial position 5 units from camera
45
+ * follower.addComponent(CursorFollow, {
46
+ * damping: 0.2, // Smooth following with 200ms damping
47
+ * keepDistance: true, // Maintain initial distance
48
+ * useFullPage: true // Track cursor across entire page
49
+ * });
50
+ * scene.add(follower);
51
+ * ```
52
+ *
53
+ * @example Surface-snapping cursor with raycast
54
+ * ```ts
55
+ * const cursor = new Object3D();
56
+ * cursor.addComponent(CursorFollow, {
57
+ * snapToSurface: true, // Snap to surfaces in the scene
58
+ * keepDistance: false, // Don't maintain distance when snapping
59
+ * damping: 0.1 // Quick, responsive movement
60
+ * });
61
+ * scene.add(cursor);
62
+ * ```
63
+ *
64
+ * @example Instant cursor following (no damping)
65
+ * ```ts
66
+ * gameObject.addComponent(CursorFollow, {
67
+ * damping: 0, // Instant movement
68
+ * useFullPage: false // Only track within canvas
69
+ * });
70
+ * ```
71
+ *
72
+ * @example Interactive 3D header that looks at cursor
73
+ * ```ts
74
+ * const character = loadModel("character.glb");
75
+ * const lookTarget = new Object3D();
76
+ * lookTarget.addComponent(CursorFollow, { damping: 0.3 });
77
+ * character.addComponent(LookAtConstraint, { target: lookTarget });
78
+ * scene.add(lookTarget, character);
79
+ * ```
80
+ *
81
+ * - Example: [Look At Cursor sample](https://engine.needle.tools/samples/look-at-cursor-interactive-3d-header/) - Combines CursorFollow with LookAt for an interactive 3D header
82
+ *
83
+ * @see {@link LookAtConstraint} - Commonly combined with CursorFollow for look-at effects
84
+ * @see {@link PointerEvents} - For more complex pointer interaction handling
85
+ * @see {@link DragControls} - For dragging objects in 3D space
86
+ * @see {@link OrbitControls} - For camera controls that work alongside CursorFollow
87
+ * @see {@link Context.input} - The input system that provides cursor position
88
+ * @see {@link Context.physics.raycastFromRay} - Used when snapToSurface is enabled
89
+ *
90
+ * @summary Makes objects follow the cursor/touch position in 3D space
20
91
  * @category Interactivity
21
92
  * @group Components
22
93
  * @component
@@ -25,25 +96,118 @@ export class CursorFollow extends Behaviour {
25
96
  // testing this for compilation
26
97
  static NAME = "CursorFollow";
27
98
  /**
28
- * Damping for the movement, set to 0 for instant movement
99
+ * Damping factor controlling how smoothly the object follows the cursor (in seconds).
100
+ *
101
+ * This value determines the "lag" or smoothness of the following motion:
102
+ * - `0`: Instant movement, no damping (object snaps directly to cursor position)
103
+ * - `0.1-0.2`: Quick, responsive following with slight smoothing
104
+ * - `0.3-0.5`: Noticeable smooth trailing effect
105
+ * - `1.0+`: Slow, heavily damped movement
106
+ *
107
+ * The damping uses delta time, so the movement speed is framerate-independent and
108
+ * provides consistent behavior across different devices.
109
+ *
110
+ * **Tip:** For look-at effects, values between 0.2-0.4 typically feel most natural.
111
+ * For cursor indicators, 0.1 or less provides better responsiveness.
112
+ *
29
113
  * @default 0
30
114
  */
31
115
  damping = 0;
32
116
  /**
33
- * When enabled the object will follow the cursor even outside of the needle-engine canvas. This is useful for example for look at effects where you have a small needle-engine element on your page and you want the 3D object to keep looking at the cursor even when it's outside of the canvas.
117
+ * Whether the object should track the cursor across the entire webpage or only within the canvas.
118
+ *
119
+ * **When `true` (default):**
120
+ * - The object follows the cursor anywhere on the page, even outside the canvas bounds
121
+ * - Perfect for look-at effects where you want continuous tracking
122
+ * - Great for embedded 3D elements that should feel aware of the whole page
123
+ * - Example: A 3D character in a hero section that watches the cursor as you scroll
124
+ *
125
+ * **When `false`:**
126
+ * - The object only follows the cursor when it's inside the Needle Engine canvas
127
+ * - Useful for contained experiences where the 3D element shouldn't react to external cursor movement
128
+ * - Better for multi-canvas scenarios or when you want isolated 3D interactions
129
+ *
130
+ * **Note:** When enabled, the component listens to `window.pointermove` events to track the
131
+ * full-page cursor position. When disabled, it uses the context's input system which is
132
+ * canvas-relative.
133
+ *
134
+ * @see {@link Context.input.mousePositionRC} for canvas-relative cursor position
34
135
  * @default true
35
136
  */
36
137
  useFullPage = true;
37
138
  /**
38
- * If true, the initial distance to the camera is maintained when following the cursor.
139
+ * Whether to maintain the object's initial distance from the camera while following the cursor.
140
+ *
141
+ * **When `true` (default):**
142
+ * - The object stays at a constant distance from the camera, moving in a spherical arc around it
143
+ * - Creates a natural "floating at cursor position" effect
144
+ * - The object's depth remains consistent as you move the cursor around
145
+ * - Perfect for cursors, pointers, or look-at targets
146
+ *
147
+ * **When `false`:**
148
+ * - The object's distance can change based on where the cursor projects in 3D space
149
+ * - More useful when combined with {@link snapToSurface} to follow surface geometry
150
+ * - Can create unusual depth behavior if not carefully configured
151
+ *
152
+ * **How it works:**
153
+ * On the first update, the component measures the distance from the object to the camera.
154
+ * This initial distance is then maintained throughout the object's lifetime (unless {@link updateDistance} is called).
155
+ * The object moves along a ray from the camera through the cursor, staying at this fixed distance.
156
+ *
157
+ * @see {@link updateDistance} to manually recalculate the distance
39
158
  * @default true
40
159
  */
41
160
  keepDistance = true;
42
161
  /**
43
- * If true, the object will attempt to snap to the surface of other objects in the scene using a raycast.
162
+ * When enabled, the object snaps to the surfaces of other objects in the scene using raycasting.
163
+ *
164
+ * **How it works:**
165
+ * After positioning the object at the cursor location, a raycast is performed backwards toward the camera.
166
+ * If the ray hits any surface, the object is moved to that hit point, effectively "snapping" to the surface.
167
+ *
168
+ * **Use cases:**
169
+ * - 3D paint or decal placement tools
170
+ * - Surface markers or waypoints
171
+ * - Interactive object placement in AR/VR
172
+ * - Cursor that follows terrain or mesh surfaces
173
+ *
174
+ * **Important notes:**
175
+ * - Requires objects in the scene to have colliders for raycasting to work
176
+ * - Works best with {@link keepDistance} set to `false` to allow depth changes
177
+ * - Can be combined with {@link damping} for smooth surface following
178
+ * - The raycast uses the physics system's raycast functionality
179
+ *
180
+ * **Debug mode:**
181
+ * Add `?debugcursor` to your URL to visualize the raycast hits with green debug lines.
182
+ *
183
+ * @see {@link Context.physics.raycastFromRay} for the underlying raycast implementation
184
+ * @see {@link keepDistance} should typically be false when using surface snapping
185
+ * @default false
44
186
  */
45
187
  snapToSurface = false;
46
188
  _distance = -1;
189
+ /**
190
+ * Manually recalculates the distance between the object and the camera.
191
+ *
192
+ * By default, the distance is calculated once when the component starts and then maintained
193
+ * when {@link keepDistance} is enabled. Use this method to update the reference distance
194
+ * if the camera or object has moved significantly.
195
+ *
196
+ * **Use cases:**
197
+ * - After teleporting the camera or object
198
+ * - When switching between different camera positions
199
+ * - After zoom operations that change the desired following distance
200
+ * - Dynamically adjusting the cursor's depth in response to user input
201
+ *
202
+ * @param force - If `true`, forces a recalculation even if {@link keepDistance} is enabled and distance was already set
203
+ *
204
+ * @example Recalculate distance after camera movement
205
+ * ```ts
206
+ * const cursorFollow = gameObject.getComponent(CursorFollow);
207
+ * camera.position.set(0, 0, 10); // Move camera
208
+ * cursorFollow?.updateDistance(true); // Update the reference distance
209
+ * ```
210
+ */
47
211
  updateDistance(force = false) {
48
212
  if (!force && (this.keepDistance && this._distance !== -1)) {
49
213
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"CursorFollow.js","sourceRoot":"","sources":["../../../src/engine-components/web/CursorFollow.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IAEvC,+BAA+B;IAC/B,MAAM,CAAU,IAAI,GAAG,cAAc,CAAC;IAEtC;;;OAG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our } from "../Component.js";
4
4
  /**
5
- * Plays a hover animation on the object this component was added to when the mouse pointer (or touch) is over the object or any of it's children.
5
+ * [HoverAnimation](https://engine.needle.tools/docs/api/HoverAnimation) plays animations in response to pointer hover events on the object this component is attached to.
6
+ * The component automatically detects when the mouse pointer or touch enters/exits the object or any of its children, triggering the corresponding animations.
6
7
  *
7
- * By default, a simple scale-up animation is used. You can customize the hover and idle animations by providing your own animation clips.
8
+ * **How It Works:**
9
+ * The component listens to pointer enter and exit events and switches between two animation states:
10
+ * - **Hover state**: Plays when the pointer enters the object (default: scale up to 110%)
11
+ * - **Idle state**: Plays when the pointer exits the object (default: returns to original scale)
8
12
  *
9
- * @summary Hover Animation on Pointer Enter/Exit
13
+ * **Default Behavior:**
14
+ * If no custom animation clips are provided, the component automatically creates a smooth scale-up animation using the
15
+ * {@link type}, {@link duration}, and {@link scaleFactor} properties. This provides instant hover feedback without
16
+ * requiring any animation setup.
17
+ *
18
+ * **Custom Animations:**
19
+ * You can provide your own animation clips for complete control over the hover effect. This allows you to create
20
+ * complex animations involving position, rotation, color changes, or any other animated property.
21
+ *
22
+ * **Common Use Cases:**
23
+ * - Interactive buttons with scale feedback
24
+ * - Product showcases with highlight animations
25
+ * - Menu items with hover effects
26
+ * - Interactive 3D objects in AR/VR experiences
27
+ * - Call-to-action elements with attention-grabbing animations
28
+ *
29
+ * @example Basic usage with default scale animation
30
+ * ```ts
31
+ * const button = new Object3D();
32
+ * button.addComponent(HoverAnimation, {
33
+ * scaleFactor: 1.2, // Scale to 120% on hover
34
+ * duration: 0.2, // 200ms animation
35
+ * type: "ease-in-out" // Smooth easing
36
+ * });
37
+ * scene.add(button);
38
+ * ```
39
+ *
40
+ * @example Custom hover animations
41
+ * ```ts
42
+ * const obj = new Object3D();
43
+ * const hoverAnim = loadAnimationClip("hover-glow.anim");
44
+ * const idleAnim = loadAnimationClip("idle-pulse.anim");
45
+ *
46
+ * obj.addComponent(HoverAnimation, {
47
+ * hovered: hoverAnim, // Custom hover animation
48
+ * idle: idleAnim // Custom idle animation
49
+ * });
50
+ * scene.add(obj);
51
+ * ```
52
+ *
53
+ * @example Quick scale animation with custom settings
54
+ * ```ts
55
+ * gameObject.addComponent(HoverAnimation, {
56
+ * scaleFactor: 1.15,
57
+ * duration: 0.15,
58
+ * type: "ease-out"
59
+ * });
60
+ * ```
61
+ *
62
+ * @see {@link Animation} - The underlying animation component used to play clips
63
+ * @see {@link AnimationClip} - For creating custom animation clips
64
+ * @see {@link AnimationUtils} - Utility functions for creating animations programmatically
65
+ * @see {@link ScaleClipType} - Available easing types for the default scale animation
66
+ * @see {@link ObjectRaycaster} - Controls which objects receive pointer events
67
+ * @see {@link PointerEvents} - For more complex pointer interaction handling
68
+ *
69
+ * @summary Plays animations on pointer hover enter/exit events
10
70
  * @category Interactivity
11
71
  * @group Components
72
+ * @component
12
73
  */
13
74
  export declare class HoverAnimation extends Behaviour {
14
75
  /**
15
- * Default hover animation type if no custom clip is provided.
16
- * **Node**: This is only used if no custom hover animation clip is provided.
76
+ * The easing type for the default scale animation.
77
+ *
78
+ * This property controls how the scale animation interpolates from the start to end value.
79
+ * Different easing types create different "feels" for the hover effect.
80
+ *
81
+ * **Available types:**
82
+ * - `"linear"`: Constant speed throughout the animation
83
+ * - `"ease-in"`: Starts slow, ends fast
84
+ * - `"ease-out"`: Starts fast, ends slow (good for responsive feel)
85
+ * - `"ease-in-out"`: Starts slow, fast in middle, ends slow (smooth and natural)
86
+ *
87
+ * **Note:** This is only used when no custom {@link hovered} animation clip is provided.
88
+ * If you provide a custom animation clip, this property is ignored.
89
+ *
90
+ * @see {@link ScaleClipType} for all available easing types
17
91
  * @default "linear"
18
92
  */
19
93
  type: ScaleClipType;
20
94
  /**
21
- * Duration of the hover animation in seconds.
22
- * **Node**: This is only used if no custom hover animation clip is provided.
95
+ * Duration of the default hover animation in seconds.
96
+ *
97
+ * This controls how long it takes for the object to scale up when hovered.
98
+ * Shorter durations feel more responsive, while longer durations feel smoother.
99
+ *
100
+ * **Recommendations:**
101
+ * - `0.1-0.15s`: Snappy, responsive feel (good for buttons)
102
+ * - `0.2-0.3s`: Smooth, noticeable animation
103
+ * - `0.4s+`: Slow, emphasized effect
104
+ *
105
+ * **Note:** This is only used when no custom {@link hovered} animation clip is provided.
106
+ * If you provide a custom animation clip, this property is ignored.
107
+ *
23
108
  * @default 0.1
24
109
  */
25
110
  duration: number;
26
111
  /**
27
- * Scale factor to apply when hovering.
28
- * **Node**: This is only used if no custom hover animation clip is provided.
112
+ * The scale multiplier to apply when the object is hovered.
113
+ *
114
+ * This value is multiplied with the object's original scale to determine the hover size.
115
+ * A value of `1.0` means no change, values greater than `1.0` scale up, and values less than `1.0` scale down.
116
+ *
117
+ * **Examples:**
118
+ * - `1.0`: No scale change
119
+ * - `1.1`: Scale to 110% (subtle effect, default)
120
+ * - `1.2`: Scale to 120% (noticeable effect)
121
+ * - `1.5`: Scale to 150% (dramatic effect)
122
+ * - `0.9`: Scale to 90% (shrink on hover)
123
+ *
124
+ * **Note:** This is only used when no custom {@link hovered} animation clip is provided.
125
+ * If you provide a custom animation clip, this property is ignored.
126
+ *
29
127
  * @default 1.1
30
128
  */
31
129
  scaleFactor: number;
32
130
  /**
33
- * Animation clip to play when hovering. If null, a default scale-up animation is used.
131
+ * Custom animation clip to play when the pointer hovers over the object.
132
+ *
133
+ * If `null`, the component automatically generates a scale-up animation based on the
134
+ * {@link type}, {@link duration}, and {@link scaleFactor} properties.
135
+ *
136
+ * Provide a custom animation clip if you want more complex hover effects such as:
137
+ * - Color changes or material property animations
138
+ * - Position or rotation changes
139
+ * - Multi-property animations
140
+ * - Animations affecting child objects
141
+ *
142
+ * **Tip:** The animation plays with a 0.1s fade duration for smooth transitions.
143
+ *
144
+ * @see {@link AnimationClip} for creating custom animation clips
145
+ * @see {@link AnimationUtils.createScaleClip} for programmatically creating scale animations
146
+ * @default null (generates default scale animation)
34
147
  */
35
148
  hovered: AnimationClip | null;
36
149
  /**
37
- * Animation clip to play when not hovering. If null, an empty clip is used.
150
+ * Custom animation clip to play when the pointer is not hovering over the object (idle state).
151
+ *
152
+ * If `null`, an empty animation clip is used, which returns the object to its original state
153
+ * when the hover animation ends.
154
+ *
155
+ * You can provide a custom idle animation for effects such as:
156
+ * - Subtle breathing or floating motion when not hovered
157
+ * - Pulsing or glowing effects in idle state
158
+ * - Return-to-normal animations with custom easing
159
+ * - Looping ambient animations
160
+ *
161
+ * **Tip:** The idle animation is played with `loop: true`, so it will repeat continuously
162
+ * until the object is hovered again.
163
+ *
164
+ * @see {@link AnimationClip} for creating custom animation clips
165
+ * @see {@link AnimationUtils.emptyClip} to see how the default empty clip is created
166
+ * @default null (uses empty clip that returns to original state)
38
167
  */
39
168
  idle: AnimationClip | null;
40
169
  private animation;