@relu-interactives/spatial-ecs 0.2.2

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 (308) hide show
  1. package/README.md +125 -0
  2. package/dist/System-rXAmagXA.d.cts +659 -0
  3. package/dist/System-rXAmagXA.d.ts +659 -0
  4. package/dist/Video-CDemv74U.d.cts +1261 -0
  5. package/dist/Video-ChKV1UI7.d.ts +1261 -0
  6. package/dist/assets/draco/draco_decoder.js +34 -0
  7. package/dist/assets/draco/draco_decoder.wasm +0 -0
  8. package/dist/assets/draco/draco_wasm_wrapper.js +117 -0
  9. package/dist/chunk-AYEF3X2P.js +223 -0
  10. package/dist/chunk-AYEF3X2P.js.map +1 -0
  11. package/dist/chunk-MAWBTMCG.js +1722 -0
  12. package/dist/chunk-MAWBTMCG.js.map +1 -0
  13. package/dist/chunk-NFDTIYR4.js +248 -0
  14. package/dist/chunk-NFDTIYR4.js.map +1 -0
  15. package/dist/chunk-OY7ZODZP.js +16 -0
  16. package/dist/chunk-OY7ZODZP.js.map +1 -0
  17. package/dist/chunk-P2YDX5DB.js +3304 -0
  18. package/dist/chunk-P2YDX5DB.js.map +1 -0
  19. package/dist/chunk-QHILSPT4.js +3 -0
  20. package/dist/chunk-QHILSPT4.js.map +1 -0
  21. package/dist/chunk-XWIEEJ7Z.js +1315 -0
  22. package/dist/chunk-XWIEEJ7Z.js.map +1 -0
  23. package/dist/components/index.cjs +1745 -0
  24. package/dist/components/index.cjs.map +1 -0
  25. package/dist/components/index.d.cts +4 -0
  26. package/dist/components/index.d.ts +4 -0
  27. package/dist/components/index.js +4 -0
  28. package/dist/components/index.js.map +1 -0
  29. package/dist/docs/api/Behaviour/classes/Behaviour.md +554 -0
  30. package/dist/docs/api/Behaviour/index.md +15 -0
  31. package/dist/docs/api/Component/classes/Component.md +57 -0
  32. package/dist/docs/api/Component/index.md +15 -0
  33. package/dist/docs/api/components/classes/AnimationComponent.md +318 -0
  34. package/dist/docs/api/components/classes/AudioComponent.md +114 -0
  35. package/dist/docs/api/components/classes/CameraComponent.md +59 -0
  36. package/dist/docs/api/components/classes/EntityType.md +48 -0
  37. package/dist/docs/api/components/classes/Environment.md +47 -0
  38. package/dist/docs/api/components/classes/ImageComponent.md +57 -0
  39. package/dist/docs/api/components/classes/ImageTarget.md +60 -0
  40. package/dist/docs/api/components/classes/ImageTargetAnchor.md +48 -0
  41. package/dist/docs/api/components/classes/LightComponent.md +70 -0
  42. package/dist/docs/api/components/classes/MaterialComponent.md +181 -0
  43. package/dist/docs/api/components/classes/MeshComponent.md +48 -0
  44. package/dist/docs/api/components/classes/MeshGeometryComponent.md +64 -0
  45. package/dist/docs/api/components/classes/ModelComponent.md +49 -0
  46. package/dist/docs/api/components/classes/Name.md +46 -0
  47. package/dist/docs/api/components/classes/Object3DRef.md +54 -0
  48. package/dist/docs/api/components/classes/ParentId.md +47 -0
  49. package/dist/docs/api/components/classes/PhysicsComponent.md +82 -0
  50. package/dist/docs/api/components/classes/Postprocessing.md +49 -0
  51. package/dist/docs/api/components/classes/ScriptComponent.md +54 -0
  52. package/dist/docs/api/components/classes/Selectable.md +46 -0
  53. package/dist/docs/api/components/classes/SelectionTransformState.md +54 -0
  54. package/dist/docs/api/components/classes/SpriteComponent.md +55 -0
  55. package/dist/docs/api/components/classes/TransformComponent.md +197 -0
  56. package/dist/docs/api/components/classes/VideoComponent.md +123 -0
  57. package/dist/docs/api/components/functions/normalizePhysicsState.md +23 -0
  58. package/dist/docs/api/components/index.md +94 -0
  59. package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +42 -0
  60. package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +45 -0
  61. package/dist/docs/api/components/type-aliases/CameraProjection.md +15 -0
  62. package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +15 -0
  63. package/dist/docs/api/components/type-aliases/ColliderShape.md +15 -0
  64. package/dist/docs/api/components/type-aliases/ColliderState.md +62 -0
  65. package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +27 -0
  66. package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +15 -0
  67. package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +37 -0
  68. package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +15 -0
  69. package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +15 -0
  70. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +34 -0
  71. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +15 -0
  72. package/dist/docs/api/components/type-aliases/EnvironmentState.md +29 -0
  73. package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +25 -0
  74. package/dist/docs/api/components/type-aliases/ImageTargetReference.md +33 -0
  75. package/dist/docs/api/components/type-aliases/LightValueState.md +41 -0
  76. package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +15 -0
  77. package/dist/docs/api/components/type-aliases/MaterialValueState.md +75 -0
  78. package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +13 -0
  79. package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +33 -0
  80. package/dist/docs/api/components/type-aliases/PhysicsState.md +25 -0
  81. package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +25 -0
  82. package/dist/docs/api/components/type-aliases/PostprocessingState.md +164 -0
  83. package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +25 -0
  84. package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +23 -0
  85. package/dist/docs/api/components/type-aliases/RigidbodyState.md +53 -0
  86. package/dist/docs/api/components/type-aliases/RigidbodyType.md +19 -0
  87. package/dist/docs/api/components/type-aliases/ScriptEntry.md +38 -0
  88. package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +15 -0
  89. package/dist/docs/api/components/type-aliases/TransformData.md +27 -0
  90. package/dist/docs/api/components/type-aliases/TransformModeValue.md +15 -0
  91. package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +15 -0
  92. package/dist/docs/api/components/type-aliases/Vec3.md +27 -0
  93. package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +13 -0
  94. package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +13 -0
  95. package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +13 -0
  96. package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +13 -0
  97. package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +13 -0
  98. package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +13 -0
  99. package/dist/docs/api/index/classes/AnimationStateMachine.md +201 -0
  100. package/dist/docs/api/index/classes/AnimationStateManager.md +253 -0
  101. package/dist/docs/api/index/classes/AnimationSystem.md +68 -0
  102. package/dist/docs/api/index/classes/AudioSystem.md +98 -0
  103. package/dist/docs/api/index/classes/CameraSyncSystem.md +49 -0
  104. package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +75 -0
  105. package/dist/docs/api/index/classes/InputSystem.md +449 -0
  106. package/dist/docs/api/index/classes/LightSyncSystem.md +49 -0
  107. package/dist/docs/api/index/classes/MaterialSyncSystem.md +67 -0
  108. package/dist/docs/api/index/classes/MeshGeometrySystem.md +49 -0
  109. package/dist/docs/api/index/classes/ObjectManagementSystem.md +298 -0
  110. package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +49 -0
  111. package/dist/docs/api/index/classes/PhysicsSyncSystem.md +83 -0
  112. package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +80 -0
  113. package/dist/docs/api/index/classes/RenderSystem.md +64 -0
  114. package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +83 -0
  115. package/dist/docs/api/index/classes/TransformSyncSystem.md +49 -0
  116. package/dist/docs/api/index/classes/VideoSystem.md +97 -0
  117. package/dist/docs/api/index/classes/World.md +1405 -0
  118. package/dist/docs/api/index/functions/createAnimationComponent.md +28 -0
  119. package/dist/docs/api/index/functions/createAudioComponent.md +32 -0
  120. package/dist/docs/api/index/functions/createCameraComponent.md +28 -0
  121. package/dist/docs/api/index/functions/createEntityTypeComponent.md +28 -0
  122. package/dist/docs/api/index/functions/createEnvironmentComponent.md +28 -0
  123. package/dist/docs/api/index/functions/createImageComponent.md +28 -0
  124. package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +28 -0
  125. package/dist/docs/api/index/functions/createImageTargetComponent.md +28 -0
  126. package/dist/docs/api/index/functions/createLightComponent.md +28 -0
  127. package/dist/docs/api/index/functions/createMaterialComponent.md +28 -0
  128. package/dist/docs/api/index/functions/createMeshComponent.md +28 -0
  129. package/dist/docs/api/index/functions/createMeshGeometryComponent.md +28 -0
  130. package/dist/docs/api/index/functions/createModelComponent.md +28 -0
  131. package/dist/docs/api/index/functions/createNameComponent.md +28 -0
  132. package/dist/docs/api/index/functions/createObject3DRefComponent.md +28 -0
  133. package/dist/docs/api/index/functions/createParentIdComponent.md +28 -0
  134. package/dist/docs/api/index/functions/createPhysicsComponent.md +30 -0
  135. package/dist/docs/api/index/functions/createPostprocessingComponent.md +28 -0
  136. package/dist/docs/api/index/functions/createScriptComponent.md +28 -0
  137. package/dist/docs/api/index/functions/createSelectableComponent.md +28 -0
  138. package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +28 -0
  139. package/dist/docs/api/index/functions/createSpriteComponent.md +28 -0
  140. package/dist/docs/api/index/functions/createTransformComponent.md +28 -0
  141. package/dist/docs/api/index/functions/createVideoComponent.md +28 -0
  142. package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +28 -0
  143. package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +28 -0
  144. package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +23 -0
  145. package/dist/docs/api/index/functions/registerDefaultFactories.md +23 -0
  146. package/dist/docs/api/index/index.md +249 -0
  147. package/dist/docs/api/index/interfaces/EcsSystem.md +50 -0
  148. package/dist/docs/api/index/interfaces/StateMachine.md +26 -0
  149. package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +25 -0
  150. package/dist/docs/api/index/type-aliases/ComponentFactory.md +25 -0
  151. package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +37 -0
  152. package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +26 -0
  153. package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +25 -0
  154. package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +23 -0
  155. package/dist/docs/api/index/type-aliases/KeyboardKey.md +13 -0
  156. package/dist/docs/api/index/type-aliases/MouseButton.md +13 -0
  157. package/dist/docs/api/index/type-aliases/SelectionContext.md +31 -0
  158. package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +13 -0
  159. package/dist/docs/api/index/variables/KeyboardKeys.md +195 -0
  160. package/dist/docs/api/index.md +15 -0
  161. package/dist/docs/api/typedoc-sidebar.json +1 -0
  162. package/dist/docs/api/types/index.md +34 -0
  163. package/dist/docs/api/types/type-aliases/AssetInput.md +23 -0
  164. package/dist/docs/api/types/type-aliases/CheckboxInput.md +13 -0
  165. package/dist/docs/api/types/type-aliases/ColorInput.md +13 -0
  166. package/dist/docs/api/types/type-aliases/ComponentInput.md +52 -0
  167. package/dist/docs/api/types/type-aliases/ComponentKind.md +37 -0
  168. package/dist/docs/api/types/type-aliases/DropdownInput.md +23 -0
  169. package/dist/docs/api/types/type-aliases/DropdownOption.md +23 -0
  170. package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +15 -0
  171. package/dist/docs/api/types/type-aliases/EcsEntityKind.md +35 -0
  172. package/dist/docs/api/types/type-aliases/EntityId.md +16 -0
  173. package/dist/docs/api/types/type-aliases/EntityInput.md +23 -0
  174. package/dist/docs/api/types/type-aliases/FloatInput.md +13 -0
  175. package/dist/docs/api/types/type-aliases/IntersectionResult.md +29 -0
  176. package/dist/docs/api/types/type-aliases/ParentLookup.md +26 -0
  177. package/dist/docs/api/types/type-aliases/SelectionListener.md +25 -0
  178. package/dist/docs/api/types/type-aliases/SliderInput.md +27 -0
  179. package/dist/docs/api/types/type-aliases/TextInput.md +13 -0
  180. package/dist/docs/api/types/type-aliases/ToggleInput.md +13 -0
  181. package/dist/docs/api/types/type-aliases/Vec3.md +23 -0
  182. package/dist/docs/api/types/type-aliases/Vector2Input.md +23 -0
  183. package/dist/docs/api/types/type-aliases/Vector3Input.md +25 -0
  184. package/dist/docs/api/types/type-aliases/WorldEntityView.md +17 -0
  185. package/dist/docs/guide/accessing-components.md +399 -0
  186. package/dist/docs/guide/authoring-a-behaviour.md +166 -0
  187. package/dist/docs/guide/behaviour-lifecycle.md +43 -0
  188. package/dist/docs/guide/component-catalog.md +59 -0
  189. package/dist/docs/guide/components/_sidebar.json +78 -0
  190. package/dist/docs/guide/components/animation.md +171 -0
  191. package/dist/docs/guide/components/audio.md +181 -0
  192. package/dist/docs/guide/components/camera.md +179 -0
  193. package/dist/docs/guide/components/entity-type.md +141 -0
  194. package/dist/docs/guide/components/image-target-anchor.md +103 -0
  195. package/dist/docs/guide/components/image-target.md +122 -0
  196. package/dist/docs/guide/components/image.md +146 -0
  197. package/dist/docs/guide/components/light.md +157 -0
  198. package/dist/docs/guide/components/material.md +161 -0
  199. package/dist/docs/guide/components/mesh-geometry.md +153 -0
  200. package/dist/docs/guide/components/mesh.md +151 -0
  201. package/dist/docs/guide/components/model.md +96 -0
  202. package/dist/docs/guide/components/name.md +121 -0
  203. package/dist/docs/guide/components/object3d-ref.md +115 -0
  204. package/dist/docs/guide/components/parent-id.md +108 -0
  205. package/dist/docs/guide/components/physics.md +163 -0
  206. package/dist/docs/guide/components/script.md +142 -0
  207. package/dist/docs/guide/components/sprite.md +155 -0
  208. package/dist/docs/guide/components/transform.md +155 -0
  209. package/dist/docs/guide/components/video.md +153 -0
  210. package/dist/docs/guide/concepts.md +34 -0
  211. package/dist/docs/guide/getting-started/creating-objects.md +50 -0
  212. package/dist/docs/guide/getting-started/editing-objects.md +62 -0
  213. package/dist/docs/guide/getting-started/editor/assets-browser.md +55 -0
  214. package/dist/docs/guide/getting-started/editor/hierarchy.md +47 -0
  215. package/dist/docs/guide/getting-started/editor/index.md +16 -0
  216. package/dist/docs/guide/getting-started/editor/inspector.md +36 -0
  217. package/dist/docs/guide/getting-started/editor/modules.md +35 -0
  218. package/dist/docs/guide/getting-started/editor/scene-inspector.md +64 -0
  219. package/dist/docs/guide/getting-started/editor/toolbar.md +39 -0
  220. package/dist/docs/guide/getting-started/editor/viewport.md +43 -0
  221. package/dist/docs/guide/getting-started/first-launch.md +17 -0
  222. package/dist/docs/guide/getting-started/index.md +37 -0
  223. package/dist/docs/guide/getting-started/installation.md +59 -0
  224. package/dist/docs/guide/getting-started/preview-and-test.md +55 -0
  225. package/dist/docs/guide/getting-started/project-types/3d.md +30 -0
  226. package/dist/docs/guide/getting-started/project-types/ar.md +6 -0
  227. package/dist/docs/guide/getting-started/project-types/face-tracking.md +6 -0
  228. package/dist/docs/guide/getting-started/project-types/image-tracking.md +42 -0
  229. package/dist/docs/guide/getting-started/project-types/index.md +25 -0
  230. package/dist/docs/guide/getting-started/project-types/vr.md +6 -0
  231. package/dist/docs/guide/getting-started/projects.md +53 -0
  232. package/dist/docs/guide/getting-started/shortcuts.md +43 -0
  233. package/dist/docs/guide/inspector-data-binding.md +367 -0
  234. package/dist/docs/guide/reading-input.md +202 -0
  235. package/dist/docs/guide/scene/environment.md +101 -0
  236. package/dist/docs/guide/scene/index.md +36 -0
  237. package/dist/docs/guide/scene/postprocessing.md +108 -0
  238. package/dist/docs/guide/spawning/ambient-light.md +28 -0
  239. package/dist/docs/guide/spawning/area-light.md +32 -0
  240. package/dist/docs/guide/spawning/audio.md +42 -0
  241. package/dist/docs/guide/spawning/camera.md +50 -0
  242. package/dist/docs/guide/spawning/capsule.md +29 -0
  243. package/dist/docs/guide/spawning/cube.md +31 -0
  244. package/dist/docs/guide/spawning/cylinder.md +29 -0
  245. package/dist/docs/guide/spawning/directional-light.md +32 -0
  246. package/dist/docs/guide/spawning/empty.md +31 -0
  247. package/dist/docs/guide/spawning/image-target.md +48 -0
  248. package/dist/docs/guide/spawning/image.md +33 -0
  249. package/dist/docs/guide/spawning/index.md +79 -0
  250. package/dist/docs/guide/spawning/model.md +31 -0
  251. package/dist/docs/guide/spawning/plane.md +31 -0
  252. package/dist/docs/guide/spawning/point-light.md +32 -0
  253. package/dist/docs/guide/spawning/sphere.md +29 -0
  254. package/dist/docs/guide/spawning/spot-light.md +32 -0
  255. package/dist/docs/guide/spawning/sprite.md +31 -0
  256. package/dist/docs/guide/spawning/video.md +53 -0
  257. package/dist/docs/guide/system-overview.md +73 -0
  258. package/dist/docs/guide/systems/_sidebar.json +66 -0
  259. package/dist/docs/guide/systems/animation-system.md +32 -0
  260. package/dist/docs/guide/systems/audio-system.md +28 -0
  261. package/dist/docs/guide/systems/camera-sync-system.md +31 -0
  262. package/dist/docs/guide/systems/environment-sync-system.md +31 -0
  263. package/dist/docs/guide/systems/input-system.md +217 -0
  264. package/dist/docs/guide/systems/light-sync-system.md +29 -0
  265. package/dist/docs/guide/systems/material-sync-system.md +32 -0
  266. package/dist/docs/guide/systems/mesh-geometry-system.md +40 -0
  267. package/dist/docs/guide/systems/object-management-system.md +38 -0
  268. package/dist/docs/guide/systems/object-visibility-system.md +26 -0
  269. package/dist/docs/guide/systems/physics-sync-system.md +56 -0
  270. package/dist/docs/guide/systems/postprocessing-sync-system.md +43 -0
  271. package/dist/docs/guide/systems/render-system.md +22 -0
  272. package/dist/docs/guide/systems/script-behaviour-system.md +59 -0
  273. package/dist/docs/guide/systems/transform-sync-system.md +29 -0
  274. package/dist/docs/guide/systems/video-system.md +30 -0
  275. package/dist/docs/guide/world-api.md +405 -0
  276. package/dist/factories/index.cjs +3077 -0
  277. package/dist/factories/index.cjs.map +1 -0
  278. package/dist/factories/index.d.cts +69 -0
  279. package/dist/factories/index.d.ts +69 -0
  280. package/dist/factories/index.js +6 -0
  281. package/dist/factories/index.js.map +1 -0
  282. package/dist/index-B4-YyUNR.d.cts +73 -0
  283. package/dist/index-BZUOKeTO.d.ts +73 -0
  284. package/dist/index.cjs +8584 -0
  285. package/dist/index.cjs.map +1 -0
  286. package/dist/index.d.cts +283 -0
  287. package/dist/index.d.ts +283 -0
  288. package/dist/index.js +1729 -0
  289. package/dist/index.js.map +1 -0
  290. package/dist/systems/index.cjs +5119 -0
  291. package/dist/systems/index.cjs.map +1 -0
  292. package/dist/systems/index.d.cts +200 -0
  293. package/dist/systems/index.d.ts +200 -0
  294. package/dist/systems/index.js +6 -0
  295. package/dist/systems/index.js.map +1 -0
  296. package/dist/types.cjs +4 -0
  297. package/dist/types.cjs.map +1 -0
  298. package/dist/types.d.cts +3 -0
  299. package/dist/types.d.ts +3 -0
  300. package/dist/types.js +3 -0
  301. package/dist/types.js.map +1 -0
  302. package/dist/worldSnapshotUtils.cjs +259 -0
  303. package/dist/worldSnapshotUtils.cjs.map +1 -0
  304. package/dist/worldSnapshotUtils.d.cts +3 -0
  305. package/dist/worldSnapshotUtils.d.ts +3 -0
  306. package/dist/worldSnapshotUtils.js +4 -0
  307. package/dist/worldSnapshotUtils.js.map +1 -0
  308. package/package.json +80 -0
@@ -0,0 +1,399 @@
1
+ # Accessing Components
2
+
3
+ Every entity in the ECS world carries a set of components — typed data containers that describe its appearance, physics, audio, animation, and more. From inside a `Behaviour` script you can read and mutate any component on the entity at runtime using `this.getComponent(ComponentClass)`.
4
+
5
+ ## The `getComponent` API
6
+
7
+ ```ts
8
+ getComponent<T extends Component>(componentClass: ComponentClass<T>): T | null
9
+ ```
10
+
11
+ Returns the component instance of the requested type attached to the **same entity** as the script, or `null` if the entity does not have that component. Always null-check the result — components are optional and may not be present on every object.
12
+
13
+ The recommended pattern is to cache the reference in `onInit` so you avoid the lookup overhead every frame:
14
+
15
+ ```ts
16
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
17
+ import { PhysicsComponent } from "@relu-interactives/spatial-ecs/components";
18
+
19
+ export default class Example extends Behaviour {
20
+ private physics: PhysicsComponent | null = null;
21
+
22
+ onInit() {
23
+ this.physics = this.getComponent(PhysicsComponent);
24
+ }
25
+
26
+ onUpdate() {
27
+ if (!this.physics) return;
28
+ // use this.physics …
29
+ }
30
+ }
31
+ ```
32
+
33
+ > `this.transform` is a pre-cached `TransformComponent` already available on every `Behaviour` — no need to call `getComponent(TransformComponent)` manually.
34
+
35
+ ---
36
+
37
+ ## Component examples
38
+
39
+ ### TransformComponent
40
+
41
+ Position, rotation (radians, Euler XYZ), and scale in local space. Available on every entity as `this.transform`.
42
+
43
+ ```ts
44
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
45
+ import { TransformComponent } from "@relu-interactives/spatial-ecs/components";
46
+ import * as THREE from "three";
47
+
48
+ export default class MoveUp extends Behaviour {
49
+ onUpdate() {
50
+ // Mutate position directly — picked up by TransformSyncSystem each frame
51
+ this.transform.position.y += this.deltaTime;
52
+
53
+ // Or use the typed helpers for Vector3 / Euler / Quaternion inputs
54
+ this.transform.setPosition(new THREE.Vector3(0, 2, 0));
55
+ this.transform.setRotation(new THREE.Euler(0, Math.PI / 2, 0));
56
+ this.transform.setScale(new THREE.Vector3(2, 2, 2));
57
+ }
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ### PhysicsComponent
64
+
65
+ Rigidbody simulation and collider. Exposes the live Rapier `rigidBody` and `collider` handles along with their authoring state (`rigidbody`, `collider`).
66
+
67
+ ```ts
68
+ import { Behaviour, type FloatInput } from "@relu-interactives/spatial-ecs";
69
+ import { PhysicsComponent } from "@relu-interactives/spatial-ecs/components";
70
+ import { Vector3 } from "three";
71
+
72
+ export default class Jumper extends Behaviour {
73
+ data = {
74
+ jumpForce: 8 as FloatInput,
75
+ };
76
+
77
+ private physics: PhysicsComponent | null = null;
78
+
79
+ onInit() {
80
+ this.physics = this.getComponent(PhysicsComponent);
81
+ }
82
+
83
+ onUpdate() {
84
+ if (!this.physics?.rigidBody) return;
85
+
86
+ // Apply an upward impulse every frame (combine with input checks in practice)
87
+ this.physics.rigidBody.addForce(
88
+ new Vector3(0, this.data.jumpForce, 0),
89
+ true, // wake the body if sleeping
90
+ );
91
+
92
+ // Change mass at runtime
93
+ this.physics.rigidbody.mass = 2;
94
+
95
+ // Lock rotation so the body can't tip over
96
+ this.physics.rigidbody.lockRotations = true;
97
+ }
98
+ }
99
+ ```
100
+
101
+ **Key fields:**
102
+
103
+ | Field | Type | Description |
104
+ |---|---|---|
105
+ | `rigidBody` | `RapierRigidBody \| null` | Live physics body handle. `null` until simulation starts. |
106
+ | `collider` | `RapierCollider \| null` | Live collider handle. |
107
+ | `rigidbody` | `RigidbodyState` | Serialized authoring state (type, mass, damping, gravity scale, lock flags). |
108
+ | `colliderState` | `ColliderState` | Serialized collider state (shape, size, offset, friction, restitution, sensor). |
109
+
110
+ ---
111
+
112
+ ### AudioComponent
113
+
114
+ Plays a stereo or 3D positional audio clip.
115
+
116
+ ```ts
117
+ import { Behaviour, type FloatInput } from "@relu-interactives/spatial-ecs";
118
+ import { AudioComponent } from "@relu-interactives/spatial-ecs/components";
119
+
120
+ export default class SoundController extends Behaviour {
121
+ data = {
122
+ volume: 1 as FloatInput,
123
+ };
124
+
125
+ private audio: AudioComponent | null = null;
126
+
127
+ onInit() {
128
+ this.audio = this.getComponent(AudioComponent);
129
+ }
130
+
131
+ onUpdate() {
132
+ if (!this.audio) return;
133
+
134
+ // Adjust volume at runtime
135
+ this.audio.options.volume = this.data.volume;
136
+
137
+ // Trigger playback
138
+ if (!this.audio.isPlaying) {
139
+ this.audio.play();
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ **Key fields / methods:**
146
+
147
+ | Member | Description |
148
+ |---|---|
149
+ | `path` | Source URL or `localasset://` path of the audio file. |
150
+ | `options.volume` | Linear gain `[0, 1]`. |
151
+ | `options.loop` | Whether the clip loops. |
152
+ | `options.pitch` | Playback rate multiplier. |
153
+ | `options.positional` | Enable 3D spatial audio. |
154
+ | `isPlaying` | Runtime-only — `true` when actively playing. |
155
+ | `play()` | Start or resume playback. |
156
+ | `pause()` | Pause mid-playback (position is preserved). |
157
+ | `stop()` | Stop and reset to the beginning. |
158
+
159
+ ---
160
+
161
+ ### AnimationComponent
162
+
163
+ Clip catalog and state-machine playback. Use `switchState` to trigger named transitions.
164
+
165
+ ```ts
166
+ import { Behaviour, type DropdownInput } from "@relu-interactives/spatial-ecs";
167
+ import { AnimationComponent } from "@relu-interactives/spatial-ecs/components";
168
+
169
+ export default class AnimationController extends Behaviour {
170
+ data = {
171
+ state: {
172
+ value: "idle",
173
+ options: [
174
+ { label: "Idle", value: "idle" },
175
+ { label: "Walk", value: "walk" },
176
+ { label: "Run", value: "run" },
177
+ ],
178
+ } as DropdownInput,
179
+ };
180
+
181
+ private anim: AnimationComponent | null = null;
182
+
183
+ onInit() {
184
+ this.anim = this.getComponent(AnimationComponent);
185
+ if (this.anim) {
186
+ this.anim.switchState(this.data.state.value);
187
+ }
188
+ }
189
+
190
+ onUpdate() {
191
+ if (!this.anim) return;
192
+
193
+ // Slow down playback at runtime
194
+ this.anim.timeScale = 0.5;
195
+
196
+ // Switch to a different clip state
197
+ if (this.anim.activeStateName !== this.data.state.value) {
198
+ this.anim.switchState(this.data.state.value);
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ **Key fields / methods:**
205
+
206
+ | Member | Description |
207
+ |---|---|
208
+ | `activeStateName` | Name of the currently playing state. |
209
+ | `timeScale` | Playback speed multiplier (`1` = real-time). |
210
+ | `paused` | Pause all playback. |
211
+ | `crossFadeDuration` | Default blend time when switching states (seconds). |
212
+ | `switchState(name)` | Transition to a named state (cross-fades). |
213
+ | `addState(entry)` | Register a new state at runtime. |
214
+ | `clipCatalog` | Array of all loaded clips with metadata. |
215
+
216
+ ---
217
+
218
+ ### LightComponent
219
+
220
+ Color, intensity, and type-specific light parameters. The live `light` property is the underlying three.js object.
221
+
222
+ ```ts
223
+ import { Behaviour, type FloatInput, type ColorInput } from "@relu-interactives/spatial-ecs";
224
+ import { LightComponent } from "@relu-interactives/spatial-ecs/components";
225
+
226
+ export default class LightPulse extends Behaviour {
227
+ data = {
228
+ minIntensity: 0.5 as FloatInput,
229
+ maxIntensity: 3 as FloatInput,
230
+ speed: 2 as FloatInput,
231
+ color: "#ffeeaa" as ColorInput,
232
+ };
233
+
234
+ private light: LightComponent | null = null;
235
+ private t = 0;
236
+
237
+ onInit() {
238
+ this.light = this.getComponent(LightComponent);
239
+ if (this.light) {
240
+ this.light.setValues({ color: this.data.color });
241
+ }
242
+ }
243
+
244
+ onUpdate() {
245
+ if (!this.light) return;
246
+ this.t += this.deltaTime * this.data.speed;
247
+
248
+ const intensity =
249
+ this.data.minIntensity +
250
+ (Math.sin(this.t) * 0.5 + 0.5) *
251
+ (this.data.maxIntensity - this.data.minIntensity);
252
+
253
+ // setValues patches only the fields you provide
254
+ this.light.setValues({ intensity });
255
+ }
256
+ }
257
+ ```
258
+
259
+ **Key fields / methods:**
260
+
261
+ | Member | Description |
262
+ |---|---|
263
+ | `light` | Live `THREE.Light` instance placed in the scene. |
264
+ | `type` | Three.js class name (`"DirectionalLight"`, `"PointLight"`, `"SpotLight"`, etc.). |
265
+ | `values.color` | Hex color string. |
266
+ | `values.intensity` | Brightness multiplier. |
267
+ | `values.castShadow` | Whether the light casts shadows. |
268
+ | `values.distance` | Max range for point/spot lights. |
269
+ | `values.angle` | Cone half-angle in radians (SpotLight). |
270
+ | `setValues(patch)` | Update any subset of `values` and sync to the live light. |
271
+
272
+ ---
273
+
274
+ ### MaterialComponent
275
+
276
+ Per-slot PBR material state and texture maps.
277
+
278
+ ```ts
279
+ import { Behaviour, type ColorInput, type FloatInput } from "@relu-interactives/spatial-ecs";
280
+ import { MaterialComponent } from "@relu-interactives/spatial-ecs/components";
281
+
282
+ export default class MaterialSwap extends Behaviour {
283
+ data = {
284
+ color: "#ff4400" as ColorInput,
285
+ roughness: 0.3 as FloatInput,
286
+ metalness: 0.8 as FloatInput,
287
+ };
288
+
289
+ private mat: MaterialComponent | null = null;
290
+
291
+ onInit() {
292
+ this.mat = this.getComponent(MaterialComponent);
293
+ }
294
+
295
+ onUpdate() {
296
+ if (!this.mat) return;
297
+
298
+ // applyValues patches one or more fields on a slot (default slot index 0)
299
+ this.mat.applyValues(0, {
300
+ color: this.data.color,
301
+ roughness: this.data.roughness,
302
+ metalness: this.data.metalness,
303
+ });
304
+ }
305
+ }
306
+ ```
307
+
308
+ **Key fields / methods:**
309
+
310
+ | Member | Description |
311
+ |---|---|
312
+ | `values` | Array of `MaterialValueState` objects, one per mesh slot. |
313
+ | `values[i].color` | Base color as `#rrggbb`. |
314
+ | `values[i].roughness` | PBR roughness `[0, 1]`. |
315
+ | `values[i].metalness` | PBR metalness `[0, 1]`. |
316
+ | `values[i].opacity` | Surface opacity `[0, 1]`. Pair with `transparent: true`. |
317
+ | `values[i].emissive` | Emissive color as `#rrggbb`. |
318
+ | `values[i].emissiveIntensity` | Emissive multiplier. |
319
+ | `values[i].wireframe` | Render as wireframe. |
320
+ | `applyValues(slotIndex, patch)` | Patch fields and sync to the live three.js material. |
321
+
322
+ ---
323
+
324
+ ### VideoComponent
325
+
326
+ Video-texture playback with optional green-screen keying.
327
+
328
+ ```ts
329
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
330
+ import { VideoComponent } from "@relu-interactives/spatial-ecs/components";
331
+
332
+ export default class VideoController extends Behaviour {
333
+ private video: VideoComponent | null = null;
334
+
335
+ onInit() {
336
+ this.video = this.getComponent(VideoComponent);
337
+ }
338
+
339
+ onUpdate() {
340
+ if (!this.video) return;
341
+
342
+ // Adjust volume while playing
343
+ this.video.options.volume = 0.5;
344
+
345
+ if (!this.video.isPlaying) {
346
+ this.video.play();
347
+ }
348
+ }
349
+ }
350
+ ```
351
+
352
+ **Key fields / methods:**
353
+
354
+ | Member | Description |
355
+ |---|---|
356
+ | `path` | Source URL or `localasset://` path of the video file. |
357
+ | `options.loop` | Loop playback. |
358
+ | `options.volume` | Linear gain `[0, 1]`. |
359
+ | `options.isGreenScreen` | Enable chroma-key compositing. |
360
+ | `options.backgroundColor` | Color to key out. |
361
+ | `videoElement` | Underlying `HTMLVideoElement`. `null` until built. |
362
+ | `isPlaying` | Runtime-only — `true` when playing. |
363
+ | `play()` | Start or resume playback. |
364
+ | `pause()` | Pause mid-playback. |
365
+ | `stop()` | Stop and reset. |
366
+
367
+ ---
368
+
369
+ ## Querying components on other entities
370
+
371
+ `getComponent` only reaches the entity the script is attached to. To read components on another entity, use `this.world.getEntityByName(name)` for the simplest lookup:
372
+
373
+ ```ts
374
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
375
+ import { LightComponent } from "@relu-interactives/spatial-ecs/components";
376
+
377
+ export default class RemoteControl extends Behaviour {
378
+ onUpdate() {
379
+ // Find an entity by name, then read its LightComponent
380
+ const entity = this.world.getEntityByName("Sun");
381
+ if (!entity) return;
382
+
383
+ const light = this.world.getComponent(entity.id, LightComponent);
384
+ if (light) light.setValues({ intensity: 2 });
385
+ }
386
+ }
387
+ ```
388
+
389
+ You can also use `this.world.getEntityById(id)` when you already have the entity ID, or `this.world.getAllEntities()` to iterate over every entity in the scene.
390
+
391
+ See [World API](./world-api) for the full set of entity and component query methods.
392
+
393
+ ---
394
+
395
+ ## See also
396
+
397
+ - [Custom Behaviours](./authoring-a-behaviour) — script anatomy and lifecycle
398
+ - [Inspector Data Binding](./inspector-data-binding) — exposing fields to the inspector
399
+ - [World API](./world-api) — querying entities and components across the scene
@@ -0,0 +1,166 @@
1
+ # Custom Behaviours
2
+
3
+ A **Behaviour** is a user-authored TypeScript class that runs per-frame logic on a single entity. Behaviours are attached to entities through the `ScriptComponent`, and are dispatched each frame by the `ScriptBehaviourSystem`.
4
+
5
+ ## Anatomy of a script
6
+
7
+ ```ts
8
+ import {
9
+ Behaviour,
10
+ type FloatInput,
11
+ type DropdownInput,
12
+ } from "@relu-interactives/spatial-ecs";
13
+
14
+ export default class Spinner extends Behaviour {
15
+ data = {
16
+ speed: 1 as FloatInput,
17
+ axis: {
18
+ value: "y",
19
+ options: [
20
+ { label: "X", value: "x" },
21
+ { label: "Y", value: "y" },
22
+ { label: "Z", value: "z" },
23
+ ],
24
+ } as DropdownInput,
25
+ };
26
+
27
+ init() {
28
+ // Called once before the first update().
29
+ }
30
+
31
+ onUpdate() {
32
+ // Called every frame while the script is enabled.
33
+ const axis = this.data.axis.value as "x" | "y" | "z";
34
+ this.transform.rotation[axis] += this.data.speed * this.deltaTime;
35
+ }
36
+
37
+ dispose() {
38
+ // Optional cleanup when the entity is destroyed
39
+ // or the script is detached.
40
+ }
41
+ }
42
+ ```
43
+
44
+ > [!IMPORTANT]
45
+ > For the runtime to recognize the class make sure the **default export** of the class subclasses [`Behaviour`](/api/Behaviour/classes/Behaviour).
46
+
47
+ ## Available context
48
+
49
+ When `init()` / `onUpdate()` runs, the following fields are populated:
50
+
51
+ | Field | Description |
52
+ | --- | --- |
53
+ | `this.world` | The owning [`World`](/api/index/classes/World). |
54
+ | `this.entityId` | Numeric entity id. |
55
+ | `this.entity` | A [`WorldEntityView`](/api/types/type-aliases/WorldEntityView) for the entity (id + components). |
56
+ | `this.transform` | Mutable [`TransformComponent`](/api/components/classes/TransformComponent) (position/rotation/scale). |
57
+ | `this.threeRef` | The [`Object3DRef`](/api/components/classes/Object3DRef) wrapping the live three.js object. |
58
+ | `this.data` | The `ScriptComponent.data` payload (your inspector fields). |
59
+ | `this.deltaTime` | Seconds since last frame. |
60
+
61
+ ## Helper methods
62
+
63
+ `Behaviour` exposes a small ergonomics surface so scripts rarely need to touch three.js directly:
64
+
65
+ - World-space math: [`getWorldPosition`](/api/Behaviour/classes/Behaviour#getworldposition), [`getWorldDirection`](/api/Behaviour/classes/Behaviour#getworlddirection), [`directionTo`](/api/Behaviour/classes/Behaviour#directionto), [`distanceTo`](/api/Behaviour/classes/Behaviour#distanceto).
66
+ - Smooth motion: [`lerpTo`](/api/Behaviour/classes/Behaviour#lerpto), [`slerpTo`](/api/Behaviour/classes/Behaviour#slerpto), [`lookAt`](/api/Behaviour/classes/Behaviour#lookat).
67
+ - Component access: [`getComponents`](/api/Behaviour/classes/Behaviour#getcomponents), [`getComponent`](/api/Behaviour/classes/Behaviour#getcomponent).
68
+ - Hierarchy: [`getEntity`](/api/Behaviour/classes/Behaviour#getentity), [`getParent`](/api/Behaviour/classes/Behaviour#getparent), [`getChildren`](/api/Behaviour/classes/Behaviour#getchildren).
69
+
70
+ See the full [`Behaviour` API](/api/Behaviour/classes/Behaviour).
71
+
72
+ ## Lifecycle hooks
73
+
74
+ | Hook | When |
75
+ | --- | --- |
76
+ | `init()` | Once, before the first `onUpdate()`. |
77
+ | `onUpdate()` | Every frame while enabled. |
78
+ | `dispose()` | When the script is detached or the entity destroyed. |
79
+ | `onSelect()` / `onDeselect()` | Events fired when a user clicks or taps an object in the scene. |
80
+ | `onTargetFound()` / `onTargetLost()` | Image-tracking target visibility changed. |
81
+
82
+ `update(deltaTime)` is implemented by the base class, do not override it. Override `onUpdate()` instead.
83
+
84
+ ## Where to put scripts
85
+
86
+ In a Relu Spatial project, scripts live under the project's `assets/` directory. The editor compiles them through esbuild and exposes them via the script registry.
87
+
88
+ ## Inspector data binding
89
+
90
+ The `data` object is the bridge between the editor inspector and your script. Use typed input annotations — `FloatInput`, `ColorInput`, `DropdownInput`, etc. — to control which inspector control renders for each field:
91
+
92
+ ```ts
93
+ import {
94
+ Behaviour,
95
+ type FloatInput,
96
+ type DropdownInput,
97
+ } from "@relu-interactives/spatial-ecs";
98
+
99
+ export default class Spinner extends Behaviour {
100
+ data = {
101
+ speed: 1 as FloatInput,
102
+ axis: {
103
+ value: "y",
104
+ options: [
105
+ { label: "X", value: "x" },
106
+ { label: "Y", value: "y" },
107
+ { label: "Z", value: "z" },
108
+ ],
109
+ } as DropdownInput,
110
+ };
111
+
112
+ onUpdate() {
113
+ const axis = this.data.axis.value as "x" | "y" | "z";
114
+ this.transform.rotation[axis] += this.data.speed * this.deltaTime;
115
+ }
116
+ }
117
+ ```
118
+
119
+ See [Inspector Data Binding](./inspector-data-binding) for the full reference of all input types (`TextInput`, `ColorInput`, `Vector2Input`, `Vector3Input`, `SliderInput`, `CheckboxInput`, `ToggleInput`, `AssetInput`, and more).
120
+
121
+ See [Accessing Components](./accessing-components) to read and mutate built-in components such as `PhysicsComponent`, `AudioComponent`, `AnimationComponent`, `LightComponent`, and `MaterialComponent` from script.
122
+
123
+ See [Reading Input](./reading-input) for the full keyboard and mouse input API, `KeyboardKeys` reference, and scripting examples.
124
+
125
+ ## Running scripts in the editor
126
+
127
+ By default, `Behaviour` scripts only execute at preview or runtime. Setting **Execute in editor** to `true` on a script entry (via the inspector toggle) enables the full lifecycle (`init` → `onUpdate`) while the editor is open.
128
+
129
+ This is useful for Three.js functionality the editor's object palette does not expose — custom shaders, procedural geometry, grass, post-processing passes, and similar.
130
+
131
+ ```ts
132
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
133
+ import * as THREE from "three";
134
+
135
+ export default class GrassPlane extends Behaviour {
136
+ private mesh: THREE.Mesh | null = null;
137
+
138
+ protected init() {
139
+ // Access the live Three.js scene directly.
140
+ const scene = this.world.getScene();
141
+
142
+ const geo = new THREE.PlaneGeometry(10, 10, 32, 32);
143
+ const mat = new THREE.MeshStandardMaterial({ color: 0x228b22 });
144
+ this.mesh = new THREE.Mesh(geo, mat);
145
+ scene.add(this.mesh);
146
+ }
147
+
148
+ protected dispose() {
149
+ if (this.mesh) {
150
+ this.world.getScene().remove(this.mesh);
151
+ this.mesh = null;
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ > [!WARNING]
158
+ > **Undo-history churn** — avoid writing to ECS components (e.g. `TransformComponent`) on every frame when `executeInEditor` is `true`. The editor's change-detection system records a new undo entry each time a component snapshot differs, which will flood the undo stack and cause performance degradation. Keep per-frame mutations in local Three.js state (objects, materials, uniforms) rather than in ECS component fields.
159
+
160
+ Available world accessors in editor mode:
161
+
162
+ | Accessor | Returns |
163
+ | --- | --- |
164
+ | `this.world.getScene()` | `THREE.Scene` |
165
+ | `this.world.getCamera()` | `THREE.PerspectiveCamera` |
166
+ | `this.world.getRenderer()` | `THREE.WebGLRenderer` |
@@ -0,0 +1,43 @@
1
+ # Behaviour Lifecycle & Events
2
+
3
+ `Behaviour` is dispatched by the `ScriptBehaviourSystem` each frame. Knowing the precise order of hooks helps you place state setup, simulation, and cleanup correctly.
4
+
5
+ ## Frame order
6
+
7
+ ```
8
+ World.update(dt)
9
+ ├── ObjectManagementSystem # parent reconciliation, entity lifecycle
10
+ ├── (geometry / material systems)
11
+ ├── (custom user systems)
12
+ ├── ScriptBehaviourSystem
13
+ │ ├── for each enabled script:
14
+ │ │ ├── if first run → init()
15
+ │ │ └── onUpdate()
16
+ ├── (sync systems)
17
+ ├── AnimationSystem
18
+ ├── TransformSyncSystem
19
+ └── RenderSystem
20
+ ```
21
+
22
+ This ordering means:
23
+
24
+ - `this.transform` mutations in `onUpdate()` are picked up the same frame by `TransformSyncSystem` and applied to the three.js object.
25
+ - Animation runs *after* scripts, so animating a value will overwrite a script's mutation on the same property.
26
+
27
+ ## Hook reference
28
+
29
+ | Hook | Override? | Frequency | Runs in editor? | Purpose |
30
+ | --- | --- | --- | --- | --- |
31
+ | `init()` | Yes (protected) | Once before first `onUpdate` | Only when `executeInEditor: true` | Default and validate `data`, cache references |
32
+ | `onUpdate()` | Yes (protected) | Every frame | Only when `executeInEditor: true` | Per-frame logic |
33
+ | `dispose()` | Yes | Once on detach/destroy | Only when `executeInEditor: true` | Release timers, listeners, resources |
34
+ | `onSelect()` / `onDeselect()` | Optional | Editor selection toggles | Yes | UX-only hooks |
35
+ | `onTargetFound()` / `onTargetLost()` | Optional | Image tracking | No | React to AR target visibility |
36
+
37
+ Set `executeInEditor: true` on a script entry in the inspector to opt a script into the full lifecycle in editor mode. See [Running scripts in the editor](./authoring-a-behaviour#running-scripts-in-the-editor).
38
+
39
+ <!-- ## Tips
40
+
41
+ - **Do not** capture `this.threeRef.object` outside hooks; the underlying `Object3D` may be replaced during hot reload.
42
+ - **Do** read `this.deltaTime` rather than computing your own delta, it respects engine pause / step.
43
+ - Use `getComponent`/`getComponents` lazily inside `onUpdate` rather than caching, unless you also handle the entity destroyed/replaced case. -->
@@ -0,0 +1,59 @@
1
+ # Component Catalog
2
+
3
+ Every entity in `@relu-interactives/spatial-ecs` is a bag of components. This catalog is a directory of every component shipped in the package, grouped by responsibility. Each entry below has a dedicated page with a screenshot of the editor inspector and a full property reference.
4
+
5
+ ![Component Catalog Image](/images/components-catalog.png)
6
+
7
+ > [!TIP]
8
+ > Browsing the API? The auto-generated TypeDoc reference for every component class lives under [API Reference → components](../api/components/).
9
+
10
+ ## Identity & hierarchy
11
+
12
+ - [Name](./components/name) — human-readable label shown in the editor hierarchy.
13
+ - [Entity Type](./components/entity-type) — tag identifying which factory created the entity.
14
+ - [Parent](./components/parent-id) — parent entity reference; reconciled into the three.js scene graph each frame.
15
+
16
+ ## Transform & motion
17
+
18
+ - [Transform](./components/transform) — position, rotation (radians), and scale.
19
+ - [Object3D Reference](./components/object3d-ref) — wraps the live `THREE.Object3D` plus a visibility flag.
20
+
21
+ ## Rendering
22
+
23
+ - [Mesh](./components/mesh) — primitive mesh `Object3D`.
24
+ - [Mesh Geometry](./components/mesh-geometry) — editable parametric geometry (cube, sphere, plane, capsule, cylinder).
25
+ - [Material](./components/material) — material catalog and texture maps.
26
+ - [Image](./components/image) — 2D image rendered as a textured quad.
27
+ - [Sprite](./components/sprite) — camera-facing billboard.
28
+ - [Video](./components/video) — video texture with optional green-screen keying.
29
+ - [Model](./components/model) — GLTF/GLB asset reference loaded asynchronously.
30
+
31
+ ## Lighting & atmosphere
32
+
33
+ - [Light](./components/light) — directional, point, spot, ambient, hemisphere, or rect-area light.
34
+ - [Environment](./scene/environment) — singleton skybox, fog, and gravity state.
35
+ - [Postprocessing](./scene/postprocessing) — singleton postprocessing stack (bloom, DoF, vignette, tonemap, etc.).
36
+ - [Camera](./components/camera) — perspective/orthographic camera with `3d`/`ar` runtime modes.
37
+
38
+ ## Audio
39
+
40
+ - [Audio](./components/audio) — audio clip with positional/listener options.
41
+
42
+ ## Physics
43
+
44
+ - [Physics](./components/physics) — combined Rapier rigid body (dynamic, fixed, kinematic) and collider (cuboid, ball, capsule, cylinder, trimesh) with per-axis motion locks and sensor support.
45
+
46
+ ## AR & image tracking
47
+
48
+ - [Image Target](./components/image-target) — image-tracking metadata and compiled `.mind` reference.
49
+ - [Image Target Anchor](./components/image-target-anchor) — entity anchored to a tracked image target.
50
+
51
+ ## Animation
52
+
53
+ - [Animation](./components/animation) — clip catalog and `AnimationStateMachine`.
54
+
55
+ ## Scripts
56
+
57
+ - [Script](./components/script) — authored behaviour scripts attached to an entity.
58
+
59
+