@needle-tools/engine 5.1.0-canary.30cc545 → 5.1.0-canary.40da791

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 (341) hide show
  1. package/.needle/generated/needle-bindings.gen.d.ts +5 -0
  2. package/CHANGELOG.md +91 -0
  3. package/SKILL.md +4 -1
  4. package/components.needle.json +1 -1
  5. package/dist/{needle-engine.bundle-d_9mSxN4.js → needle-engine.bundle-Cu2B9CsR.js} +16112 -15269
  6. package/dist/needle-engine.bundle-ZoVUaB89.umd.cjs +1733 -0
  7. package/dist/needle-engine.bundle-hBWUJPxm.min.js +1733 -0
  8. package/dist/needle-engine.d.ts +1527 -384
  9. package/dist/needle-engine.js +573 -569
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/dist/three.js +1 -0
  13. package/dist/three.min.js +21 -21
  14. package/dist/three.umd.cjs +16 -16
  15. package/lib/engine/api.d.ts +8 -1
  16. package/lib/engine/api.js +6 -0
  17. package/lib/engine/api.js.map +1 -1
  18. package/lib/engine/codegen/register_types.js +10 -18
  19. package/lib/engine/codegen/register_types.js.map +1 -1
  20. package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
  21. package/lib/engine/debug/debug_spatial_console.js +10 -7
  22. package/lib/engine/debug/debug_spatial_console.js.map +1 -1
  23. package/lib/engine/engine_addressables.d.ts +2 -0
  24. package/lib/engine/engine_addressables.js +6 -3
  25. package/lib/engine/engine_addressables.js.map +1 -1
  26. package/lib/engine/engine_audio.d.ts +68 -0
  27. package/lib/engine/engine_audio.js +172 -0
  28. package/lib/engine/engine_audio.js.map +1 -1
  29. package/lib/engine/engine_camera.fit.js +16 -4
  30. package/lib/engine/engine_camera.fit.js.map +1 -1
  31. package/lib/engine/engine_components.js +1 -1
  32. package/lib/engine/engine_components.js.map +1 -1
  33. package/lib/engine/engine_context.d.ts +41 -27
  34. package/lib/engine/engine_context.js +57 -30
  35. package/lib/engine/engine_context.js.map +1 -1
  36. package/lib/engine/engine_context_eventbus.d.ts +47 -0
  37. package/lib/engine/engine_context_eventbus.js +47 -0
  38. package/lib/engine/engine_context_eventbus.js.map +1 -0
  39. package/lib/engine/engine_disposable.d.ts +172 -0
  40. package/lib/engine/engine_disposable.js +136 -0
  41. package/lib/engine/engine_disposable.js.map +1 -0
  42. package/lib/engine/engine_gameobject.d.ts +1 -10
  43. package/lib/engine/engine_gameobject.js +22 -120
  44. package/lib/engine/engine_gameobject.js.map +1 -1
  45. package/lib/engine/engine_gltf_builtin_components.js +7 -69
  46. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  47. package/lib/engine/engine_init.js +16 -1
  48. package/lib/engine/engine_init.js.map +1 -1
  49. package/lib/engine/engine_input.d.ts +24 -5
  50. package/lib/engine/engine_input.js +3 -2
  51. package/lib/engine/engine_input.js.map +1 -1
  52. package/lib/engine/engine_instantiate_resolve.d.ts +42 -0
  53. package/lib/engine/engine_instantiate_resolve.js +372 -0
  54. package/lib/engine/engine_instantiate_resolve.js.map +1 -0
  55. package/lib/engine/engine_license.d.ts +2 -0
  56. package/lib/engine/engine_license.js +14 -6
  57. package/lib/engine/engine_license.js.map +1 -1
  58. package/lib/engine/engine_lifecycle_functions_internal.js +5 -0
  59. package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
  60. package/lib/engine/engine_mainloop_utils.js +7 -4
  61. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  62. package/lib/engine/engine_networking.d.ts +51 -37
  63. package/lib/engine/engine_networking.js +132 -82
  64. package/lib/engine/engine_networking.js.map +1 -1
  65. package/lib/engine/engine_networking.transport.websocket.d.ts +15 -0
  66. package/lib/engine/engine_networking.transport.websocket.js +38 -0
  67. package/lib/engine/engine_networking.transport.websocket.js.map +1 -0
  68. package/lib/engine/engine_networking_blob.js +1 -1
  69. package/lib/engine/engine_networking_blob.js.map +1 -1
  70. package/lib/engine/engine_networking_instantiate.js +2 -2
  71. package/lib/engine/engine_networking_instantiate.js.map +1 -1
  72. package/lib/engine/engine_networking_types.d.ts +39 -1
  73. package/lib/engine/engine_networking_types.js +7 -0
  74. package/lib/engine/engine_networking_types.js.map +1 -1
  75. package/lib/engine/engine_physics_rapier.d.ts +21 -3
  76. package/lib/engine/engine_physics_rapier.js +94 -25
  77. package/lib/engine/engine_physics_rapier.js.map +1 -1
  78. package/lib/engine/engine_scenedata.d.ts +13 -17
  79. package/lib/engine/engine_scenedata.js +58 -31
  80. package/lib/engine/engine_scenedata.js.map +1 -1
  81. package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
  82. package/lib/engine/engine_serialization_builtin_serializer.js +56 -46
  83. package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
  84. package/lib/engine/engine_serialization_core.d.ts +1 -0
  85. package/lib/engine/engine_serialization_core.js +7 -0
  86. package/lib/engine/engine_serialization_core.js.map +1 -1
  87. package/lib/engine/engine_ssr.d.ts +2 -0
  88. package/lib/engine/engine_ssr.js +2 -0
  89. package/lib/engine/engine_ssr.js.map +1 -1
  90. package/lib/engine/engine_types.d.ts +31 -11
  91. package/lib/engine/engine_types.js +1 -1
  92. package/lib/engine/engine_types.js.map +1 -1
  93. package/lib/engine/engine_util_decorator.js +7 -2
  94. package/lib/engine/engine_util_decorator.js.map +1 -1
  95. package/lib/engine/engine_utils.d.ts +1 -1
  96. package/lib/engine/engine_utils.js +19 -5
  97. package/lib/engine/engine_utils.js.map +1 -1
  98. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  99. package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
  100. package/lib/engine/webcomponents/jsx.d.ts +51 -0
  101. package/lib/engine/webcomponents/logo-element.js.map +1 -1
  102. package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +3 -4
  103. package/lib/engine/webcomponents/needle menu/needle-menu.js +1 -1
  104. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  105. package/lib/engine/webcomponents/needle-button.js.map +1 -1
  106. package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
  107. package/lib/engine/webcomponents/needle-engine.js +1 -1
  108. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  109. package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
  110. package/lib/engine/xr/NeedleXRSession.js +50 -14
  111. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  112. package/lib/engine/xr/events.d.ts +1 -1
  113. package/lib/engine/xr/events.js.map +1 -1
  114. package/lib/engine-components/Animation.js +17 -16
  115. package/lib/engine-components/Animation.js.map +1 -1
  116. package/lib/engine-components/AnimationBuilder.d.ts +158 -0
  117. package/lib/engine-components/AnimationBuilder.js +305 -0
  118. package/lib/engine-components/AnimationBuilder.js.map +1 -0
  119. package/lib/engine-components/Animator.d.ts +6 -0
  120. package/lib/engine-components/Animator.js +23 -13
  121. package/lib/engine-components/Animator.js.map +1 -1
  122. package/lib/engine-components/AnimatorController.builder.d.ts +191 -0
  123. package/lib/engine-components/AnimatorController.builder.js +263 -0
  124. package/lib/engine-components/AnimatorController.builder.js.map +1 -0
  125. package/lib/engine-components/AnimatorController.d.ts +4 -119
  126. package/lib/engine-components/AnimatorController.js +37 -233
  127. package/lib/engine-components/AnimatorController.js.map +1 -1
  128. package/lib/engine-components/AudioSource.d.ts +19 -3
  129. package/lib/engine-components/AudioSource.js +121 -68
  130. package/lib/engine-components/AudioSource.js.map +1 -1
  131. package/lib/engine-components/Collider.d.ts +18 -9
  132. package/lib/engine-components/Collider.js +61 -14
  133. package/lib/engine-components/Collider.js.map +1 -1
  134. package/lib/engine-components/Component.d.ts +72 -9
  135. package/lib/engine-components/Component.js +114 -10
  136. package/lib/engine-components/Component.js.map +1 -1
  137. package/lib/engine-components/ContactShadows.d.ts +1 -0
  138. package/lib/engine-components/ContactShadows.js +14 -1
  139. package/lib/engine-components/ContactShadows.js.map +1 -1
  140. package/lib/engine-components/DragControls.d.ts +7 -0
  141. package/lib/engine-components/DragControls.js +19 -7
  142. package/lib/engine-components/DragControls.js.map +1 -1
  143. package/lib/engine-components/DropListener.js +3 -0
  144. package/lib/engine-components/DropListener.js.map +1 -1
  145. package/lib/engine-components/EventList.d.ts +31 -9
  146. package/lib/engine-components/EventList.js +37 -76
  147. package/lib/engine-components/EventList.js.map +1 -1
  148. package/lib/engine-components/Joints.d.ts +4 -2
  149. package/lib/engine-components/Joints.js +19 -3
  150. package/lib/engine-components/Joints.js.map +1 -1
  151. package/lib/engine-components/Light.d.ts +6 -8
  152. package/lib/engine-components/Light.js +48 -27
  153. package/lib/engine-components/Light.js.map +1 -1
  154. package/lib/engine-components/Networking.d.ts +1 -1
  155. package/lib/engine-components/Networking.js +1 -1
  156. package/lib/engine-components/OrbitControls.d.ts +0 -2
  157. package/lib/engine-components/OrbitControls.js +30 -12
  158. package/lib/engine-components/OrbitControls.js.map +1 -1
  159. package/lib/engine-components/ReflectionProbe.js +2 -0
  160. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  161. package/lib/engine-components/RigidBody.d.ts +12 -4
  162. package/lib/engine-components/RigidBody.js +18 -4
  163. package/lib/engine-components/RigidBody.js.map +1 -1
  164. package/lib/engine-components/SceneSwitcher.js +3 -0
  165. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  166. package/lib/engine-components/SeeThrough.js +2 -2
  167. package/lib/engine-components/SeeThrough.js.map +1 -1
  168. package/lib/engine-components/api.d.ts +2 -1
  169. package/lib/engine-components/api.js +2 -1
  170. package/lib/engine-components/api.js.map +1 -1
  171. package/lib/engine-components/codegen/components.d.ts +7 -13
  172. package/lib/engine-components/codegen/components.js +7 -13
  173. package/lib/engine-components/codegen/components.js.map +1 -1
  174. package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
  175. package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
  176. package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
  177. package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
  178. package/lib/engine-components/timeline/PlayableDirector.d.ts +21 -11
  179. package/lib/engine-components/timeline/PlayableDirector.js +75 -67
  180. package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
  181. package/lib/engine-components/timeline/SignalAsset.d.ts +3 -1
  182. package/lib/engine-components/timeline/SignalAsset.js +1 -0
  183. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  184. package/lib/engine-components/timeline/TimelineBuilder.d.ts +413 -0
  185. package/lib/engine-components/timeline/TimelineBuilder.js +506 -0
  186. package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -0
  187. package/lib/engine-components/timeline/TimelineModels.d.ts +2 -1
  188. package/lib/engine-components/timeline/TimelineModels.js +3 -0
  189. package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
  190. package/lib/engine-components/timeline/TimelineTracks.d.ts +37 -6
  191. package/lib/engine-components/timeline/TimelineTracks.js +92 -26
  192. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  193. package/lib/engine-components/timeline/index.d.ts +2 -1
  194. package/lib/engine-components/timeline/index.js +2 -0
  195. package/lib/engine-components/timeline/index.js.map +1 -1
  196. package/lib/engine-components/ui/Canvas.d.ts +1 -1
  197. package/lib/engine-components/ui/Canvas.js +2 -8
  198. package/lib/engine-components/ui/Canvas.js.map +1 -1
  199. package/lib/engine-components/ui/Text.d.ts +1 -0
  200. package/lib/engine-components/ui/Text.js +10 -7
  201. package/lib/engine-components/ui/Text.js.map +1 -1
  202. package/lib/engine-components/web/CursorFollow.d.ts +0 -1
  203. package/lib/engine-components/web/CursorFollow.js +21 -13
  204. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  205. package/lib/engine-components/webxr/WebXRImageTracking.js +4 -0
  206. package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
  207. package/lib/needle-engine.d.ts +2 -0
  208. package/lib/needle-engine.js +2 -0
  209. package/lib/needle-engine.js.map +1 -1
  210. package/package.json +3 -83
  211. package/plugins/common/license.js +5 -2
  212. package/plugins/common/worker.js +9 -4
  213. package/plugins/dts-generator/dts.codegen.js +255 -50
  214. package/plugins/dts-generator/dts.scan.js +37 -9
  215. package/plugins/dts-generator/dts.writer.js +1 -1
  216. package/plugins/dts-generator/glb.discovery.js +140 -23
  217. package/plugins/dts-generator/glb.extractor.js +48 -8
  218. package/plugins/dts-generator/glb.reader.js +80 -27
  219. package/plugins/dts-generator/index.js +1 -1
  220. package/plugins/types/needle-bindings.d.ts +25 -14
  221. package/plugins/types/userconfig.d.ts +12 -0
  222. package/plugins/vite/asap.js +18 -9
  223. package/plugins/vite/dependencies.js +29 -10
  224. package/plugins/vite/dependency-watcher.d.ts +2 -2
  225. package/plugins/vite/dependency-watcher.js +5 -6
  226. package/plugins/vite/drop.d.ts +2 -2
  227. package/plugins/vite/drop.js +3 -4
  228. package/plugins/vite/dts-generator.d.ts +2 -2
  229. package/plugins/vite/dts-generator.js +43 -9
  230. package/plugins/vite/editor-connection.js +3 -3
  231. package/plugins/vite/index.d.ts +9 -3
  232. package/plugins/vite/index.js +23 -10
  233. package/plugins/vite/license.js +19 -1
  234. package/plugins/vite/local-files-core.js +3 -3
  235. package/plugins/vite/local-files-utils.d.ts +3 -1
  236. package/plugins/vite/local-files-utils.js +29 -5
  237. package/plugins/vite/meta.js +4 -2
  238. package/plugins/vite/poster.d.ts +2 -2
  239. package/plugins/vite/poster.js +3 -5
  240. package/plugins/vite/reload.d.ts +2 -2
  241. package/plugins/vite/reload.js +23 -23
  242. package/plugins/vite/server.js +2 -1
  243. package/src/engine/api.ts +11 -1
  244. package/src/engine/codegen/register_types.ts +10 -18
  245. package/src/engine/debug/debug_spatial_console.ts +10 -7
  246. package/src/engine/engine_addressables.ts +6 -3
  247. package/src/engine/engine_audio.ts +184 -0
  248. package/src/engine/engine_camera.fit.ts +15 -4
  249. package/src/engine/engine_components.ts +1 -1
  250. package/src/engine/engine_context.ts +67 -37
  251. package/src/engine/engine_context_eventbus.ts +73 -0
  252. package/src/engine/engine_disposable.ts +214 -0
  253. package/src/engine/engine_gameobject.ts +54 -159
  254. package/src/engine/engine_gltf_builtin_components.ts +7 -76
  255. package/src/engine/engine_init.ts +15 -1
  256. package/src/engine/engine_input.ts +28 -7
  257. package/src/engine/engine_instantiate_resolve.ts +407 -0
  258. package/src/engine/engine_license.ts +12 -10
  259. package/src/engine/engine_lifecycle_functions_internal.ts +7 -0
  260. package/src/engine/engine_mainloop_utils.ts +7 -4
  261. package/src/engine/engine_networking.transport.websocket.ts +45 -0
  262. package/src/engine/engine_networking.ts +161 -137
  263. package/src/engine/engine_networking_blob.ts +1 -1
  264. package/src/engine/engine_networking_instantiate.ts +2 -2
  265. package/src/engine/engine_networking_types.ts +41 -1
  266. package/src/engine/engine_physics_rapier.ts +102 -33
  267. package/src/engine/engine_scenedata.ts +56 -30
  268. package/src/engine/engine_serialization_builtin_serializer.ts +64 -52
  269. package/src/engine/engine_serialization_core.ts +9 -0
  270. package/src/engine/engine_ssr.ts +3 -0
  271. package/src/engine/engine_types.ts +48 -27
  272. package/src/engine/engine_util_decorator.ts +7 -2
  273. package/src/engine/engine_utils.ts +16 -5
  274. package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
  275. package/src/engine/webcomponents/jsx.d.ts +51 -0
  276. package/src/engine/webcomponents/logo-element.ts +1 -0
  277. package/src/engine/webcomponents/needle menu/needle-menu.ts +3 -2
  278. package/src/engine/webcomponents/needle-button.ts +1 -0
  279. package/src/engine/webcomponents/needle-engine.ts +11 -4
  280. package/src/engine/xr/NeedleXRSession.ts +48 -13
  281. package/src/engine/xr/events.ts +1 -1
  282. package/src/engine-components/Animation.ts +19 -16
  283. package/src/engine-components/AnimationBuilder.ts +472 -0
  284. package/src/engine-components/Animator.ts +24 -12
  285. package/src/engine-components/AnimatorController.builder.ts +387 -0
  286. package/src/engine-components/AnimatorController.ts +24 -292
  287. package/src/engine-components/AudioSource.ts +130 -79
  288. package/src/engine-components/Collider.ts +66 -18
  289. package/src/engine-components/Component.ts +118 -20
  290. package/src/engine-components/ContactShadows.ts +15 -1
  291. package/src/engine-components/DragControls.ts +18 -11
  292. package/src/engine-components/DropListener.ts +3 -0
  293. package/src/engine-components/EventList.ts +45 -83
  294. package/src/engine-components/Joints.ts +20 -4
  295. package/src/engine-components/Light.ts +49 -27
  296. package/src/engine-components/Networking.ts +1 -1
  297. package/src/engine-components/OrbitControls.ts +34 -14
  298. package/src/engine-components/ReflectionProbe.ts +2 -0
  299. package/src/engine-components/RigidBody.ts +18 -4
  300. package/src/engine-components/SceneSwitcher.ts +3 -0
  301. package/src/engine-components/SeeThrough.ts +2 -2
  302. package/src/engine-components/api.ts +2 -1
  303. package/src/engine-components/codegen/components.ts +7 -13
  304. package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
  305. package/src/engine-components/timeline/PlayableDirector.ts +83 -81
  306. package/src/engine-components/timeline/SignalAsset.ts +4 -1
  307. package/src/engine-components/timeline/TimelineBuilder.ts +824 -0
  308. package/src/engine-components/timeline/TimelineModels.ts +5 -1
  309. package/src/engine-components/timeline/TimelineTracks.ts +96 -27
  310. package/src/engine-components/timeline/index.ts +2 -1
  311. package/src/engine-components/ui/Canvas.ts +2 -8
  312. package/src/engine-components/ui/Text.ts +12 -8
  313. package/src/engine-components/web/CursorFollow.ts +21 -14
  314. package/src/engine-components/webxr/WebXRImageTracking.ts +2 -0
  315. package/src/needle-engine.ts +3 -0
  316. package/dist/needle-engine.bundle-BMlLSACE.umd.cjs +0 -1732
  317. package/dist/needle-engine.bundle-BXPPQRer.min.js +0 -1732
  318. package/lib/engine-components/AvatarLoader.d.ts +0 -80
  319. package/lib/engine-components/AvatarLoader.js +0 -232
  320. package/lib/engine-components/AvatarLoader.js.map +0 -1
  321. package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +0 -11
  322. package/lib/engine-components/avatar/AvatarBlink_Simple.js +0 -77
  323. package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +0 -1
  324. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +0 -14
  325. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +0 -69
  326. package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +0 -1
  327. package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +0 -29
  328. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +0 -122
  329. package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +0 -1
  330. package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +0 -15
  331. package/lib/engine-components/avatar/Avatar_MouthShapes.js +0 -80
  332. package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +0 -1
  333. package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +0 -9
  334. package/lib/engine-components/avatar/Avatar_MustacheShake.js +0 -30
  335. package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +0 -1
  336. package/src/engine-components/AvatarLoader.ts +0 -264
  337. package/src/engine-components/avatar/AvatarBlink_Simple.ts +0 -70
  338. package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +0 -64
  339. package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +0 -140
  340. package/src/engine-components/avatar/Avatar_MouthShapes.ts +0 -84
  341. package/src/engine-components/avatar/Avatar_MustacheShake.ts +0 -32
@@ -1,12 +1,12 @@
1
1
  import { CameraHelper, Color, DirectionalLight, DirectionalLightHelper, Light as ThreeLight, OrthographicCamera, PointLight, SpotLight, Vector3 } from "three";
2
2
 
3
3
  import { serializable } from "../engine/engine_serialization_decorator.js";
4
- import { FrameEvent } from "../engine/engine_setup.js";
5
4
  import { setWorldPositionXYZ } from "../engine/engine_three_utils.js";
6
5
  import type { ILight } from "../engine/engine_types.js";
7
6
  import { getParam } from "../engine/engine_utils.js";
8
7
  import type { NeedleXREventArgs } from "../engine/xr/api.js";
9
8
  import { Behaviour, GameObject } from "./Component.js";
9
+ import { isDevEnvironment } from "../engine/debug/index.js";
10
10
 
11
11
  // https://threejs.org/examples/webgl_shadowmap_csm.html
12
12
 
@@ -106,11 +106,43 @@ enum LightShadows {
106
106
  export class Light extends Behaviour implements ILight {
107
107
 
108
108
  /**
109
- * The type of light (spot, directional, point, etc.)
110
- * Can not be changed at runtime.
109
+ * The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"`.
110
+ * Implements {@link ILight.type}. Can not be changed at runtime.
111
111
  */
112
+ get type(): ILight["type"] {
113
+ return this._type;
114
+ }
115
+
116
+ /** Numeric LightType serialized from Unity/Blender — converts to string on write */
112
117
  @serializable()
113
- private type: LightType = 0;
118
+ set type(value: LightType | ILight["type"]) {
119
+ if (this.light && this.__didAwake) {
120
+ throw new Error("Changing the light type at runtime is not supported");
121
+ }
122
+ switch (value) {
123
+ case LightType.Directional:
124
+ this._type = "directional";
125
+ break;
126
+ case LightType.Point:
127
+ this._type = "point";
128
+ break;
129
+ case LightType.Spot:
130
+ this._type = "spot";
131
+ break;
132
+ case "directional":
133
+ case "point":
134
+ case "spot":
135
+ this._type = value;
136
+ break;
137
+ default:
138
+ if (debug || isDevEnvironment())
139
+ console.warn(`[Light] Unsupported light type: ${LightType[value]} (${value}) on '${this.name}'`);
140
+ this._type = "unsupported" as any;
141
+ break;
142
+ }
143
+ }
144
+ private _type: ILight["type"] = "point";
145
+
114
146
 
115
147
  /**
116
148
  * The maximum distance the light affects.
@@ -345,7 +377,7 @@ export class Light extends Behaviour implements ILight {
345
377
  */
346
378
  public getWorldPosition(vec: Vector3): Vector3 {
347
379
  if (this.light) {
348
- if (this.type === LightType.Directional) {
380
+ if (this.type === "directional") {
349
381
  return this.light.getWorldPosition(vec).multiplyScalar(1);
350
382
  }
351
383
  return this.light.getWorldPosition(vec);
@@ -372,12 +404,13 @@ export class Light extends Behaviour implements ILight {
372
404
  else if (this.light.parent !== this.gameObject)
373
405
  this.gameObject.add(this.light);
374
406
  }
375
- if (this.type === LightType.Directional)
376
- this.startCoroutine(this.updateMainLightRoutine(), FrameEvent.LateUpdate);
407
+ this.context.lights.push(this);
377
408
  }
378
409
 
379
410
  onDisable() {
380
411
  if (debug) console.log("DISABLE LIGHT", this.name);
412
+ const index = this.context.lights.indexOf(this);
413
+ if (index !== -1) this.context.lights.splice(index, 1);
381
414
  if (this.light) {
382
415
  if (this.selfIsLight)
383
416
  this.light.intensity = 0;
@@ -399,14 +432,14 @@ export class Light extends Behaviour implements ILight {
399
432
  this._intensity = this.light.intensity;
400
433
 
401
434
  switch (this.type) {
402
- case LightType.Directional:
435
+ case "directional":
403
436
  this.setDirectionalLight(this.light as DirectionalLight);
404
437
  break;
405
438
  }
406
439
  }
407
440
  else if (!this.light) {
408
441
  switch (this.type) {
409
- case LightType.Directional:
442
+ case "directional":
410
443
  // console.log(this);
411
444
  const dirLight = new DirectionalLight(this.color, this.intensity * Math.PI);
412
445
  // directional light target is at 0 0 0 by default
@@ -425,7 +458,7 @@ export class Light extends Behaviour implements ILight {
425
458
  }
426
459
  break;
427
460
 
428
- case LightType.Spot:
461
+ case "spot":
429
462
  const spotLight = new SpotLight(this.color, this.intensity * Math.PI, this.range, toRadians(this.spotAngle / 2), 1 - toRadians(this.innerSpotAngle / 2) / toRadians(this.spotAngle / 2), 2);
430
463
  spotLight.position.set(0, 0, 0);
431
464
  spotLight.rotation.set(0, 0, 0);
@@ -437,13 +470,18 @@ export class Light extends Behaviour implements ILight {
437
470
  spotLightTarget.rotation.set(0, 0, 0);
438
471
  break;
439
472
 
440
- case LightType.Point:
473
+ case "point":
441
474
  const pointLight = new PointLight(this.color, this.intensity * Math.PI, this.range);
442
475
  this.light = pointLight;
443
476
 
444
477
  // const pointHelper = new PointLightHelper(pointLight, this.range, this.color);
445
478
  // scene.add(pointHelper);
446
479
  break;
480
+
481
+ default:
482
+ if (debug) console.warn(`[Light] Unsupported light type: ${LightType[this.type as any]} (${this.type}) on '${this.name}'`);
483
+ break;
484
+
447
485
  }
448
486
  }
449
487
 
@@ -526,22 +564,6 @@ export class Light extends Behaviour implements ILight {
526
564
 
527
565
  }
528
566
 
529
- /**
530
- * Coroutine that updates the main light reference in the context
531
- * if this directional light should be the main light
532
- */
533
- *updateMainLightRoutine() {
534
- while (true) {
535
- if (this.type === LightType.Directional) {
536
- if (!this.context.mainLight || this.intensity > this.context.mainLight.intensity) {
537
- this.context.mainLight = this;
538
- }
539
- yield;
540
- }
541
- break;
542
- }
543
- }
544
-
545
567
  /**
546
568
  * Controls whether the renderer's shadow map type can be changed when soft shadows are used
547
569
  */
@@ -37,7 +37,7 @@ const debug = getParam("debugnet");
37
37
  * @see {@link RoomEvents} for room lifecycle events
38
38
  * @see {@link isLocalNetwork} for local network detection
39
39
  * @link https://engine.needle.tools/docs/how-to-guides/networking/
40
- * @summary Networking configuration
40
+ * @summary Configures the websocket server URL for multiplayer networking
41
41
  * @category Networking
42
42
  * @group Components
43
43
  */
@@ -663,7 +663,15 @@ export class OrbitControls extends Behaviour implements ICameraController {
663
663
  }
664
664
  this._controls.enabled = true;
665
665
 
666
- if (this.context.input.getPointerDown(1) || this.context.input.getPointerDown(2) || this.context.input.mouseWheelChanged || (this.context.input.getPointerPressed(0) && this.context.input.getPointerPositionDelta(0)?.length() || 0 > .1)) {
666
+ // Interrupt programmatic transitions on meaningful new user interaction:
667
+ // - Middle/right button down (always intentional camera control)
668
+ // - Mouse wheel (zoom intent)
669
+ // - Left button drag start: getPointerDown(0) with a position delta — a bare click
670
+ // without movement shouldn't cancel an animation, but starting to drag should.
671
+ // Using getPointerDown (not getPointerPressed) ensures we only interrupt once at
672
+ // drag onset, not continuously every frame during a drag.
673
+ const leftDragStart = this.context.input.getPointerDown(0) && (this.context.input.getPointerPositionDelta(0)?.length() || 0) > .1;
674
+ if (this.context.input.getPointerDown(1) || this.context.input.getPointerDown(2) || this.context.input.mouseWheelChanged || leftDragStart) {
667
675
  this._inputs += 1;
668
676
  }
669
677
  if (this._inputs > 0 && this.allowInterrupt) {
@@ -758,19 +766,26 @@ export class OrbitControls extends Behaviour implements ICameraController {
758
766
 
759
767
  if (this.targetBounds) {
760
768
  // #region target bounds
761
- const targetVector = this._controls.target;
762
769
  const boundsCenter = this.targetBounds.worldPosition;
763
770
  const boundsHalfSize = getTempVector(this.targetBounds.worldScale).multiplyScalar(0.5);
764
771
  const min = getTempVector(boundsCenter).sub(boundsHalfSize);
765
772
  const max = getTempVector(boundsCenter).add(boundsHalfSize);
766
- const newTarget = getTempVector(this._controls.target).clamp(min, max);
767
- const duration = .1;
768
- if (duration <= 0) targetVector.copy(newTarget);
769
- else targetVector.lerp(newTarget, this.context.time.deltaTime / duration);
773
+
770
774
  if (this._lookTargetLerpActive) {
771
- if (duration <= 0) this._lookTargetEndPosition.copy(newTarget);
772
- else this._lookTargetEndPosition.lerp(newTarget, this.context.time.deltaTime / (duration * 5));
775
+ // During a programmatic transition (fitCamera / setLookTargetPosition with immediate: false),
776
+ // only clamp the destination. The look-target lerp (above) handles moving _controls.target
777
+ // towards the endpoint — we must not fight it by also lerping _controls.target here.
778
+ this._lookTargetEndPosition.clamp(min, max);
779
+ }
780
+ else {
781
+ // Interactive use (pan/orbit): smoothly push the target back into bounds
782
+ const targetVector = this._controls.target;
783
+ const newTarget = getTempVector(targetVector).clamp(min, max);
784
+ const duration = .1;
785
+ if (duration <= 0) targetVector.copy(newTarget);
786
+ else targetVector.lerp(newTarget, Math.min(1, this.context.time.deltaTime / duration));
773
787
  }
788
+
774
789
  if (debug) {
775
790
  Gizmos.DrawWireBox(boundsCenter, boundsHalfSize.multiplyScalar(2), 0xffaa00);
776
791
  }
@@ -847,7 +862,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
847
862
  this._controls.update(this.context.time.deltaTime);
848
863
 
849
864
  if (debug) {
850
- Gizmos.DrawWireSphere(this._controls.target, 0.1, 0x00ff00);
865
+ const distance = this._controls.getDistance();
866
+ Gizmos.DrawWireSphere(this._controls.target, 0.01 * distance, 0x00ff00);
851
867
  }
852
868
  }
853
869
  }
@@ -1022,7 +1038,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
1022
1038
 
1023
1039
  if (debug) {
1024
1040
  console.warn("OrbitControls: setLookTargetPosition", position, immediateOrDuration);
1025
- Gizmos.DrawWireSphere(this._lookTargetEndPosition, .2, 0xff0000, 2);
1041
+ const distance = this._controls.getDistance();
1042
+ Gizmos.DrawWireSphere(this._lookTargetEndPosition, 0.01 * distance, 0xff5500, 2);
1026
1043
  }
1027
1044
 
1028
1045
  if (immediateOrDuration === true) {
@@ -1086,13 +1103,16 @@ export class OrbitControls extends Behaviour implements ICameraController {
1086
1103
  // Adapted from https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24
1087
1104
  // Slower but better implementation that takes bones and exact vertex positions into account: https://github.com/google/model-viewer/blob/04e900c5027de8c5306fe1fe9627707f42811b05/packages/model-viewer/src/three-components/ModelScene.ts#L321
1088
1105
 
1089
- /**
1090
- * Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
1106
+ /**
1107
+ * Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
1091
1108
  * @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
1092
1109
  */
1093
1110
  fitCamera(options?: OrbitFitCameraOptions);
1094
- /** @deprecated Use fitCamera(options) */
1095
- fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">);
1111
+ // Deprecated overload commented out: it accepted Object3D as first arg, which caused
1112
+ // TypeScript autocomplete to show Object3D properties (position, worldPosition, etc.)
1113
+ // instead of OrbitFitCameraOptions. The implementation still handles Object3D at runtime
1114
+ // for backwards-compat — use fitCamera({ objects: [...] }) instead.
1115
+ // fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">);
1096
1116
  fitCamera(objectsOrOptions?: Object3D | Array<Object3D> | OrbitFitCameraOptions, options?: OrbitFitCameraOptions): void {
1097
1117
 
1098
1118
 
@@ -290,6 +290,8 @@ export class ReflectionProbe extends Behaviour {
290
290
  const current = block.getOverride("envMap")?.value;
291
291
  if (current === this.texture) {
292
292
  block.removeOveride("envMap");
293
+ block.removeOveride("envMapRotation");
294
+ block.removeOveride("envMapIntensity");
293
295
  }
294
296
  }
295
297
  }
@@ -204,12 +204,19 @@ export class Rigidbody extends Behaviour implements IRigidbody {
204
204
 
205
205
  get isRigidbody() { return true; }
206
206
 
207
- /** When true the mass will be automatically calculated by the attached colliders */
207
+ /** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
208
+ * Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
209
+ * Disable to set mass explicitly via the `mass` property.
210
+ */
208
211
  @validate()
209
212
  autoMass: boolean = true;
210
213
 
211
- /** By default the mass will be automatically calculated (see `autoMass`) by the physics engine using the collider sizes
212
- * To set the mass manually you can either set the `mass` value or set `autoMass` to `false`
214
+ /** The mass of the rigidbody in kg (when `autoMass` is disabled).
215
+ * When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
216
+ * Setting this property automatically disables `autoMass`.
217
+ *
218
+ * **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
219
+ * naturally with collider size, while explicit mass stays fixed regardless of shape changes.
213
220
  */
214
221
  @serializable()
215
222
  set mass(value: number) {
@@ -403,9 +410,16 @@ export class Rigidbody extends Behaviour implements IRigidbody {
403
410
  this.context.physics.engine?.removeBody(this);
404
411
  }
405
412
 
406
- onValidate() {
413
+ onValidate(property?: string) {
407
414
  this._propertiesChanged = true;
415
+ if (property === "autoMass" && !this.autoMass) {
416
+ if (isDevEnvironment() && !Rigidbody._didWarnAutoMass) {
417
+ Rigidbody._didWarnAutoMass = true;
418
+ console.warn("[Rigidbody] autoMass disabled — consider using Collider.density instead of setting mass explicitly. Density scales naturally with collider size.");
419
+ }
420
+ }
408
421
  }
422
+ private static _didWarnAutoMass = false;
409
423
 
410
424
  // need to do this right before updating physics to prevent rendered object glitching through physical bodies
411
425
  * beforePhysics() {
@@ -747,6 +747,9 @@ export class SceneSwitcher extends Behaviour {
747
747
  const openedEvt = new CustomEvent<LoadSceneEvent>("scene-opened", { detail: { scene: scene, switcher: this, index: index } });
748
748
  this.dispatchEvent(openedEvt);
749
749
  this.sceneLoaded?.invoke(this);
750
+ if (this._currentSceneAsset) {
751
+ this.context.events.emit("scene-content-changed", { source: this, object: this._currentSceneAsset });
752
+ }
750
753
  return true;
751
754
  }
752
755
  }
@@ -249,10 +249,10 @@ export class SeeThrough extends Behaviour {
249
249
  }
250
250
 
251
251
  const materials = renderer.sharedMaterials;// : this.rendererMaterials.get(renderer);
252
- if (!materials) return;
252
+ if (!materials?.length) return;
253
253
 
254
254
  const block = MaterialPropertyBlock.get(renderer.gameObject);
255
- const currentOpacity = (block.getOverride("opacity")?.value ?? materials[0].opacity ?? 1);
255
+ const currentOpacity = (block.getOverride("opacity")?.value ?? materials[0]?.opacity ?? 1);
256
256
 
257
257
  let newAlpha = Mathf.lerp(currentOpacity, targetAlpha, duration <= 0 ? 1 : this.context.time.deltaTime / duration);;
258
258
  if (newAlpha >= 0.99) newAlpha = 1;
@@ -34,8 +34,9 @@
34
34
  * @module Built-in Components
35
35
  */
36
36
 
37
+ export { AnimationBuilder, type AnimationKeyframe, type Tween, type AnimationInterpolation } from "./AnimationBuilder.js";
38
+ export { AnimatorControllerBuilder, type ConditionMode, type StateOptions, type TransitionOptions } from "./AnimatorController.builder.js";
37
39
  export * from "./codegen/components.js";
38
- export { AnimatorControllerBuilder, type ConditionMode, type StateOptions, type TransitionOptions } from "./AnimatorController.js";
39
40
  export { Collider } from "./Collider.js"; // export abstract type
40
41
  export { Behaviour, Component, GameObject } from "./Component.js";
41
42
 
@@ -3,21 +3,13 @@
3
3
  export class __Ignore {}
4
4
  export { AlignmentConstraint } from "../AlignmentConstraint.js";
5
5
  export { Animation } from "../Animation.js";
6
+ export { AnimationBuilder } from "../AnimationBuilder.js";
6
7
  export { Keyframe } from "../AnimationCurve.js";
7
8
  export { AnimationCurve } from "../AnimationCurve.js";
8
9
  export { Animator } from "../Animator.js";
9
- export { AnimatorControllerBuilder } from "../AnimatorController.js";
10
10
  export { AnimatorController } from "../AnimatorController.js";
11
11
  export { AudioListener } from "../AudioListener.js";
12
12
  export { AudioSource } from "../AudioSource.js";
13
- export { Avatar_POI } from "../avatar/Avatar_Brain_LookAt.js";
14
- export { Avatar_Brain_LookAt } from "../avatar/Avatar_Brain_LookAt.js";
15
- export { Avatar_MouthShapes } from "../avatar/Avatar_MouthShapes.js";
16
- export { Avatar_MustacheShake } from "../avatar/Avatar_MustacheShake.js";
17
- export { AvatarBlink_Simple } from "../avatar/AvatarBlink_Simple.js";
18
- export { AvatarEyeLook_Rotation } from "../avatar/AvatarEyeLook_Rotation.js";
19
- export { AvatarModel } from "../AvatarLoader.js";
20
- export { AvatarLoader } from "../AvatarLoader.js";
21
13
  export { AxesHelper } from "../AxesHelper.js";
22
14
  export { BasicIKConstraint } from "../BasicIKConstraint.js";
23
15
  export { BoxHelperComponent } from "../BoxHelperComponent.js";
@@ -168,11 +160,13 @@ export { PlayableDirector } from "../timeline/PlayableDirector.js";
168
160
  export { SignalAsset } from "../timeline/SignalAsset.js";
169
161
  export { SignalReceiverEvent } from "../timeline/SignalAsset.js";
170
162
  export { SignalReceiver } from "../timeline/SignalAsset.js";
171
- export { AnimationTrackHandler } from "../timeline/TimelineTracks.js";
172
- export { AudioTrackHandler } from "../timeline/TimelineTracks.js";
173
- export { MarkerTrackHandler } from "../timeline/TimelineTracks.js";
163
+ export { TimelineBuilder } from "../timeline/TimelineBuilder.js";
164
+ export { TimelineAnimationTrack } from "../timeline/TimelineTracks.js";
165
+ export { TimelineAudioTrack } from "../timeline/TimelineTracks.js";
166
+ export { TimelineMarkerTrack } from "../timeline/TimelineTracks.js";
174
167
  export { SignalTrackHandler } from "../timeline/TimelineTracks.js";
175
- export { ControlTrackHandler } from "../timeline/TimelineTracks.js";
168
+ export { TimelineActivationTrack } from "../timeline/TimelineTracks.js";
169
+ export { TimelineControlTrack } from "../timeline/TimelineTracks.js";
176
170
  export { TransformGizmo } from "../TransformGizmo.js";
177
171
  export { BaseUIComponent } from "../ui/BaseUIComponent.js";
178
172
  export { UIRootComponent } from "../ui/BaseUIComponent.js";
@@ -156,4 +156,7 @@ class VolumeParameterSerializer extends TypeSerializer {
156
156
  return parameter;
157
157
  }
158
158
  }
159
- new VolumeParameterSerializer();
159
+ /** @internal */
160
+ export function initVolumeParameterSerializer() {
161
+ new VolumeParameterSerializer();
162
+ }