@relu-interactives/spatial-ecs 0.2.12 → 0.2.14

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 (220) hide show
  1. package/dist/{System-CHCucemW.d.cts → System-BeuJ1xt5.d.cts} +291 -2
  2. package/dist/{System-CHCucemW.d.ts → System-BeuJ1xt5.d.ts} +291 -2
  3. package/dist/{Video-B9ZKmBIT.d.ts → Video-Cym2C52L.d.ts} +2 -241
  4. package/dist/{Video-ACTSfWjH.d.cts → Video-D4B-z74P.d.cts} +2 -241
  5. package/dist/{chunk-PH43YHUT.js → chunk-27RBPOVO.js} +3 -3
  6. package/dist/{chunk-PH43YHUT.js.map → chunk-27RBPOVO.js.map} +1 -1
  7. package/dist/{chunk-ZCEMOTH4.js → chunk-7QBONTBW.js} +4 -4
  8. package/dist/{chunk-ZCEMOTH4.js.map → chunk-7QBONTBW.js.map} +1 -1
  9. package/dist/{chunk-XPCVEXMY.js → chunk-FTIQQK62.js} +2 -2
  10. package/dist/chunk-FTIQQK62.js.map +1 -0
  11. package/dist/{chunk-ON4E5E5O.js → chunk-KDZ6VBRO.js} +4 -4
  12. package/dist/{chunk-ON4E5E5O.js.map → chunk-KDZ6VBRO.js.map} +1 -1
  13. package/dist/components/index.cjs.map +1 -1
  14. package/dist/components/index.d.cts +2 -2
  15. package/dist/components/index.d.ts +2 -2
  16. package/dist/components/index.js +1 -1
  17. package/dist/docs/api/Behaviour/classes/Behaviour.md +29 -29
  18. package/dist/docs/api/Component/classes/Component.md +1 -1
  19. package/dist/docs/api/components/classes/AnimationComponent.md +26 -26
  20. package/dist/docs/api/components/classes/AudioComponent.md +19 -19
  21. package/dist/docs/api/components/classes/CameraComponent.md +14 -14
  22. package/dist/docs/api/components/classes/EntityType.md +3 -3
  23. package/dist/docs/api/components/classes/Environment.md +7 -3
  24. package/dist/docs/api/components/classes/ImageComponent.md +7 -7
  25. package/dist/docs/api/components/classes/ImageTarget.md +7 -7
  26. package/dist/docs/api/components/classes/ImageTargetAnchor.md +4 -4
  27. package/dist/docs/api/components/classes/InstanceSlotComponent.md +4 -4
  28. package/dist/docs/api/components/classes/InstancedMeshComponent.md +10 -10
  29. package/dist/docs/api/components/classes/LightComponent.md +6 -6
  30. package/dist/docs/api/components/classes/MaterialComponent.md +11 -11
  31. package/dist/docs/api/components/classes/MeshComponent.md +3 -3
  32. package/dist/docs/api/components/classes/MeshGeometryComponent.md +9 -9
  33. package/dist/docs/api/components/classes/ModelComponent.md +4 -4
  34. package/dist/docs/api/components/classes/Name.md +3 -3
  35. package/dist/docs/api/components/classes/Object3DRef.md +4 -4
  36. package/dist/docs/api/components/classes/ParentId.md +3 -3
  37. package/dist/docs/api/components/classes/PhysicsComponent.md +6 -6
  38. package/dist/docs/api/components/classes/Postprocessing.md +7 -3
  39. package/dist/docs/api/components/classes/ScriptComponent.md +5 -5
  40. package/dist/docs/api/components/classes/Selectable.md +3 -3
  41. package/dist/docs/api/components/classes/SelectionTransformState.md +5 -5
  42. package/dist/docs/api/components/classes/SpriteComponent.md +7 -7
  43. package/dist/docs/api/components/classes/TransformComponent.md +12 -12
  44. package/dist/docs/api/components/classes/VideoComponent.md +28 -28
  45. package/dist/docs/api/components/functions/normalizePhysicsState.md +1 -1
  46. package/dist/docs/api/components/index.md +1 -1
  47. package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +9 -9
  48. package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +13 -13
  49. package/dist/docs/api/components/type-aliases/CameraProjection.md +1 -1
  50. package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +1 -1
  51. package/dist/docs/api/components/type-aliases/ColliderShape.md +1 -1
  52. package/dist/docs/api/components/type-aliases/ColliderState.md +20 -20
  53. package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +4 -4
  54. package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +1 -1
  55. package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +8 -8
  56. package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +1 -1
  57. package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +1 -1
  58. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +7 -7
  59. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +1 -1
  60. package/dist/docs/api/components/type-aliases/EnvironmentState.md +5 -5
  61. package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +3 -3
  62. package/dist/docs/api/components/type-aliases/ImageTargetReference.md +7 -7
  63. package/dist/docs/api/components/type-aliases/InstanceTransform.md +13 -13
  64. package/dist/docs/api/components/type-aliases/InstancedMeshKind.md +1 -1
  65. package/dist/docs/api/components/type-aliases/LightValueState.md +11 -11
  66. package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +1 -1
  67. package/dist/docs/api/components/type-aliases/MaterialValueState.md +28 -28
  68. package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +1 -1
  69. package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +7 -7
  70. package/dist/docs/api/components/type-aliases/PhysicsState.md +3 -3
  71. package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +3 -3
  72. package/dist/docs/api/components/type-aliases/PostprocessingState.md +62 -62
  73. package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +3 -3
  74. package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +2 -2
  75. package/dist/docs/api/components/type-aliases/RigidbodyState.md +17 -17
  76. package/dist/docs/api/components/type-aliases/RigidbodyType.md +1 -1
  77. package/dist/docs/api/components/type-aliases/ScriptEntry.md +9 -9
  78. package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +1 -1
  79. package/dist/docs/api/components/type-aliases/TransformData.md +4 -4
  80. package/dist/docs/api/components/type-aliases/TransformModeValue.md +1 -1
  81. package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +1 -1
  82. package/dist/docs/api/components/type-aliases/Vec3.md +4 -4
  83. package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +1 -1
  84. package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +1 -1
  85. package/dist/docs/api/components/variables/DEFAULT_INSTANCED_MESH_PARAMETERS.md +1 -1
  86. package/dist/docs/api/components/variables/DEFAULT_INSTANCE_TRANSFORM.md +1 -1
  87. package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +1 -1
  88. package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +1 -1
  89. package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +1 -1
  90. package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +1 -1
  91. package/dist/docs/api/index/classes/AnimationStateMachine.md +16 -16
  92. package/dist/docs/api/index/classes/AnimationStateManager.md +13 -13
  93. package/dist/docs/api/index/classes/AnimationSystem.md +3 -3
  94. package/dist/docs/api/index/classes/AudioSystem.md +4 -4
  95. package/dist/docs/api/index/classes/CameraSyncSystem.md +2 -2
  96. package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +4 -4
  97. package/dist/docs/api/index/classes/InputSystem.md +33 -33
  98. package/dist/docs/api/index/classes/InstancedMeshSystem.md +2 -2
  99. package/dist/docs/api/index/classes/LightSyncSystem.md +2 -2
  100. package/dist/docs/api/index/classes/MaterialSyncSystem.md +3 -3
  101. package/dist/docs/api/index/classes/MeshGeometrySystem.md +2 -2
  102. package/dist/docs/api/index/classes/ObjectManagementSystem.md +14 -14
  103. package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +2 -2
  104. package/dist/docs/api/index/classes/PhysicsSyncSystem.md +4 -4
  105. package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +4 -4
  106. package/dist/docs/api/index/classes/RenderSystem.md +3 -3
  107. package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +4 -4
  108. package/dist/docs/api/index/classes/TransformSyncSystem.md +2 -2
  109. package/dist/docs/api/index/classes/VideoSystem.md +4 -4
  110. package/dist/docs/api/index/classes/World.md +186 -82
  111. package/dist/docs/api/index/functions/createAnimationComponent.md +1 -1
  112. package/dist/docs/api/index/functions/createAudioComponent.md +1 -1
  113. package/dist/docs/api/index/functions/createCameraComponent.md +1 -1
  114. package/dist/docs/api/index/functions/createEntityTypeComponent.md +1 -1
  115. package/dist/docs/api/index/functions/createEnvironmentComponent.md +1 -1
  116. package/dist/docs/api/index/functions/createImageComponent.md +1 -1
  117. package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +1 -1
  118. package/dist/docs/api/index/functions/createImageTargetComponent.md +1 -1
  119. package/dist/docs/api/index/functions/createInstanceSlotComponent.md +1 -1
  120. package/dist/docs/api/index/functions/createInstancedMeshComponent.md +1 -1
  121. package/dist/docs/api/index/functions/createLightComponent.md +1 -1
  122. package/dist/docs/api/index/functions/createMaterialComponent.md +1 -1
  123. package/dist/docs/api/index/functions/createMeshComponent.md +1 -1
  124. package/dist/docs/api/index/functions/createMeshGeometryComponent.md +1 -1
  125. package/dist/docs/api/index/functions/createModelComponent.md +1 -1
  126. package/dist/docs/api/index/functions/createNameComponent.md +1 -1
  127. package/dist/docs/api/index/functions/createObject3DRefComponent.md +1 -1
  128. package/dist/docs/api/index/functions/createParentIdComponent.md +1 -1
  129. package/dist/docs/api/index/functions/createPhysicsComponent.md +1 -1
  130. package/dist/docs/api/index/functions/createPostprocessingComponent.md +1 -1
  131. package/dist/docs/api/index/functions/createScriptComponent.md +1 -1
  132. package/dist/docs/api/index/functions/createSelectableComponent.md +1 -1
  133. package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +1 -1
  134. package/dist/docs/api/index/functions/createSpriteComponent.md +1 -1
  135. package/dist/docs/api/index/functions/createTransformComponent.md +1 -1
  136. package/dist/docs/api/index/functions/createVideoComponent.md +1 -1
  137. package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +1 -1
  138. package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +1 -1
  139. package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +1 -1
  140. package/dist/docs/api/index/functions/registerDefaultFactories.md +1 -1
  141. package/dist/docs/api/index/interfaces/EcsSystem.md +3 -3
  142. package/dist/docs/api/index/interfaces/StateMachine.md +13 -13
  143. package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +4 -4
  144. package/dist/docs/api/index/type-aliases/ComponentFactory.md +1 -1
  145. package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +1 -1
  146. package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +3 -3
  147. package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +4 -4
  148. package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +3 -3
  149. package/dist/docs/api/index/type-aliases/KeyboardKey.md +1 -1
  150. package/dist/docs/api/index/type-aliases/MouseButton.md +1 -1
  151. package/dist/docs/api/index/type-aliases/SelectionContext.md +4 -4
  152. package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +1 -1
  153. package/dist/docs/api/index/variables/KeyboardKeys.md +89 -89
  154. package/dist/docs/api/types/type-aliases/AssetInput.md +3 -3
  155. package/dist/docs/api/types/type-aliases/CheckboxInput.md +12 -2
  156. package/dist/docs/api/types/type-aliases/ColorInput.md +1 -1
  157. package/dist/docs/api/types/type-aliases/ComponentInput.md +4 -4
  158. package/dist/docs/api/types/type-aliases/ComponentKind.md +1 -1
  159. package/dist/docs/api/types/type-aliases/DropdownInput.md +3 -3
  160. package/dist/docs/api/types/type-aliases/DropdownOption.md +3 -3
  161. package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +1 -1
  162. package/dist/docs/api/types/type-aliases/EcsEntityKind.md +1 -1
  163. package/dist/docs/api/types/type-aliases/EntityId.md +1 -1
  164. package/dist/docs/api/types/type-aliases/EntityInput.md +3 -3
  165. package/dist/docs/api/types/type-aliases/FloatInput.md +1 -1
  166. package/dist/docs/api/types/type-aliases/IntersectionResult.md +3 -3
  167. package/dist/docs/api/types/type-aliases/ParentLookup.md +3 -3
  168. package/dist/docs/api/types/type-aliases/SelectionListener.md +1 -1
  169. package/dist/docs/api/types/type-aliases/SliderInput.md +5 -5
  170. package/dist/docs/api/types/type-aliases/TextInput.md +1 -1
  171. package/dist/docs/api/types/type-aliases/ToggleInput.md +1 -1
  172. package/dist/docs/api/types/type-aliases/Vec3.md +1 -1
  173. package/dist/docs/api/types/type-aliases/Vector2Input.md +3 -3
  174. package/dist/docs/api/types/type-aliases/Vector3Input.md +4 -4
  175. package/dist/docs/api/types/type-aliases/WorldEntityView.md +1 -1
  176. package/dist/docs/guide/accessing-components.md +135 -1
  177. package/dist/docs/guide/authoring-a-behaviour.md +1 -1
  178. package/dist/docs/guide/behaviour-data-binding/asset-input.md +54 -0
  179. package/dist/docs/guide/behaviour-data-binding/checkbox-input.md +38 -0
  180. package/dist/docs/guide/behaviour-data-binding/color-input.md +38 -0
  181. package/dist/docs/guide/behaviour-data-binding/component-input.md +79 -0
  182. package/dist/docs/guide/behaviour-data-binding/dropdown-input.md +53 -0
  183. package/dist/docs/guide/behaviour-data-binding/entity-input.md +100 -0
  184. package/dist/docs/guide/behaviour-data-binding/float-input.md +35 -0
  185. package/dist/docs/guide/behaviour-data-binding/index.md +158 -0
  186. package/dist/docs/guide/behaviour-data-binding/slider-input.md +37 -0
  187. package/dist/docs/guide/behaviour-data-binding/text-input.md +35 -0
  188. package/dist/docs/guide/behaviour-data-binding/toggle-input.md +36 -0
  189. package/dist/docs/guide/behaviour-data-binding/vector2-input.md +36 -0
  190. package/dist/docs/guide/behaviour-data-binding/vector3-input.md +41 -0
  191. package/dist/docs/guide/components/parent-id.md +25 -0
  192. package/dist/docs/guide/runtime-entity-management.md +302 -0
  193. package/dist/docs/guide/scene/environment.md +5 -6
  194. package/dist/docs/guide/scene/index.md +5 -10
  195. package/dist/docs/guide/scene/postprocessing.md +5 -6
  196. package/dist/docs/guide/systems/object-management-system.md +61 -0
  197. package/dist/docs/guide/world-api.md +37 -1
  198. package/dist/factories/index.cjs.map +1 -1
  199. package/dist/factories/index.d.cts +2 -2
  200. package/dist/factories/index.d.ts +2 -2
  201. package/dist/factories/index.js +3 -3
  202. package/dist/{index-B5JcGMJ5.d.ts → index-BfoOC2CG.d.cts} +2 -2
  203. package/dist/{index-kx5O2mVU.d.cts → index-BoJ3_6a3.d.ts} +2 -2
  204. package/dist/index.cjs +65 -0
  205. package/dist/index.cjs.map +1 -1
  206. package/dist/index.d.cts +5 -5
  207. package/dist/index.d.ts +5 -5
  208. package/dist/index.js +73 -8
  209. package/dist/index.js.map +1 -1
  210. package/dist/systems/index.cjs.map +1 -1
  211. package/dist/systems/index.d.cts +2 -2
  212. package/dist/systems/index.d.ts +2 -2
  213. package/dist/systems/index.js +3 -3
  214. package/dist/types.d.cts +1 -1
  215. package/dist/types.d.ts +1 -1
  216. package/dist/worldSnapshotUtils.d.cts +1 -1
  217. package/dist/worldSnapshotUtils.d.ts +1 -1
  218. package/package.json +1 -1
  219. package/dist/chunk-XPCVEXMY.js.map +0 -1
  220. package/dist/docs/guide/inspector-data-binding.md +0 -367
@@ -12,15 +12,14 @@ It is a **singleton** there is exactly one `Environment` entity per scene, owned
12
12
 
13
13
  ## Get the component from the world
14
14
 
15
+ Use `world.getEnvironmentComponent()` — a convenience method that handles the entity lookup for you:
16
+
15
17
  ```ts
16
- import { Behaviour, Environment } from "@relu-interactives/spatial-ecs";
18
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
17
19
 
18
20
  export default class ReadEnvironment extends Behaviour {
19
21
  init() {
20
- const [entityId] = this.world.query(Environment);
21
- if (entityId === undefined) return;
22
-
23
- const env = this.world.getComponent(entityId, Environment);
22
+ const env = this.world.getEnvironmentComponent();
24
23
  if (!env) return;
25
24
 
26
25
  console.log("skybox type", env.values.skybox.type);
@@ -29,7 +28,7 @@ export default class ReadEnvironment extends Behaviour {
29
28
  }
30
29
  ```
31
30
 
32
- `env.values` is the live state object. Mutating fields on it is enough, the `EnvironmentSyncSystem` reads it every frame and pushes changes into the three.js scene.
31
+ `env.values` is the live state object. Mutating fields on it is enough — `EnvironmentSyncSystem` reads it every frame and pushes changes into the three.js scene.
33
32
 
34
33
  ## Change values at runtime
35
34
 
@@ -9,22 +9,17 @@ Some settings live on the **scene** rather than on a single object the skybox, f
9
9
 
10
10
  ## Pattern
11
11
 
12
- Both components follow the same access pattern from a script:
12
+ Both components expose a convenience method on `world` — no manual entity lookup needed:
13
13
 
14
14
  ```ts
15
- import { Behaviour, Environment, Postprocessing } from "@relu-interactives/spatial-ecs";
15
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
16
16
 
17
17
  export default class TweakScene extends Behaviour {
18
18
  init() {
19
- // 1. Find the singleton entity that owns the component.
20
- const [entityId] = this.world.query(Environment);
21
- if (entityId === undefined) return;
22
-
23
- // 2. Read the component instance.
24
- const env = this.world.getComponent(entityId, Environment);
19
+ const env = this.world.getEnvironmentComponent();
25
20
  if (!env) return;
26
21
 
27
- // 3. Mutate `env.values` — sync systems pick the change up next frame.
22
+ // Mutate `env.values` — sync systems pick the change up next frame.
28
23
  env.values.fog.type = "linear";
29
24
  env.values.fog.color = "#88aaff";
30
25
  env.values.fog.linear.near = 5;
@@ -33,4 +28,4 @@ export default class TweakScene extends Behaviour {
33
28
  }
34
29
  ```
35
30
 
36
- The same shape works for `Postprocessing` — see each page for the full set of authorable values.
31
+ The same pattern works for `Postprocessing` via `this.world.getPostprocessingComponent()` — see each page for the full set of authorable values.
@@ -11,15 +11,14 @@ It is a **singleton** there is exactly one `Postprocessing` entity per scene, ow
11
11
 
12
12
  ## Get the component from the world
13
13
 
14
+ Use `world.getPostprocessingComponent()` — a convenience method that handles the entity lookup for you:
15
+
14
16
  ```ts
15
- import { Behaviour, Postprocessing } from "@relu-interactives/spatial-ecs";
17
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
16
18
 
17
19
  export default class ReadPostprocessing extends Behaviour {
18
20
  init() {
19
- const [entityId] = this.world.query(Postprocessing);
20
- if (entityId === undefined) return;
21
-
22
- const post = this.world.getComponent(entityId, Postprocessing);
21
+ const post = this.world.getPostprocessingComponent();
23
22
  if (!post) return;
24
23
 
25
24
  console.log("post enabled?", post.values.postEnabled);
@@ -27,7 +26,7 @@ export default class ReadPostprocessing extends Behaviour {
27
26
  }
28
27
  ```
29
28
 
30
- `post.values` is the live state object mutate fields on it directly. The `PostprocessingSyncSystem` reads it every frame and rebuilds the composer pipeline as effects are toggled.
29
+ `post.values` is the live state object — mutate fields on it directly. The `PostprocessingSyncSystem` reads it every frame and rebuilds the composer pipeline as effects are toggled.
31
30
 
32
31
  ## Change values at runtime
33
32
 
@@ -44,4 +44,65 @@ Component kinds (e.g. `"animation"`, `"physics"`) are registered with `registerC
44
44
 
45
45
  ## API reference
46
46
 
47
+ ### `requestCreate(kind, payload?, onCreated?)`
48
+
49
+ Queue a new entity creation request. The factory for the given `kind` runs on the next frame; the optional `onCreated` callback fires with the new `entityId`:
50
+
51
+ ```ts
52
+ const oms = this.world.getObjectManagementSystem();
53
+
54
+ oms?.requestCreate("cube", {
55
+ name: "DynamicCube",
56
+ transform: { position: { x: 0, y: 2, z: 0 } },
57
+ }, (entityId) => {
58
+ // entityId is ready — add more components here
59
+ });
60
+ ```
61
+
62
+ ### `createComponentNow(kind, world, entityId, ...args)`
63
+
64
+ Synchronously call the registered component factory for `kind` on an existing entity. Use this instead of `world.addComponent` when the component needs runtime setup (Rapier bodies, Web Audio nodes, Three.js material instances):
65
+
66
+ ```ts
67
+ // Add physics with full Rapier body + collider setup
68
+ oms.createComponentNow("physics", world, entityId, {
69
+ rigidbody: { type: "dynamic", mass: 1, gravityScale: 1 },
70
+ collider: { shape: "box" },
71
+ });
72
+
73
+ // Add a material with a Three.js material instance
74
+ oms.createComponentNow("material", world, entityId, { color: "#ff0000" });
75
+ ```
76
+
77
+ Registered factory kinds: `"animation"`, `"audio"`, `"camera"`, `"physics"`, `"environment"`, `"entityType"`, `"image"`, `"imageTarget"`, `"imageTargetAnchor"`, `"light"`, `"material"`, `"mesh"`, `"meshGeometry"`, `"model"`, `"name"`, `"object3DRef"`, `"parentId"`, `"postprocessing"`, `"script"`, `"sprite"`, `"transform"`, `"video"`, `"instancedMesh"`.
78
+
79
+ ### `deleteEntity(world, entityId, dispose?)`
80
+
81
+ Remove an entity from the ECS world and its `Object3D` from the Three.js scene graph. Pass `dispose = true` to also free GPU memory by calling `.dispose()` on all `BufferGeometry` and `Material` instances in the subtree:
82
+
83
+ ```ts
84
+ // Remove from scene, keep GPU resources (safe if geometry is shared)
85
+ oms.deleteEntity(world, entityId);
86
+
87
+ // Remove from scene and free GPU memory (use for dynamically spawned objects)
88
+ oms.deleteEntity(world, entityId, true);
89
+ ```
90
+
91
+ ### `setParent(world, entityId, parentId, options?)`
92
+
93
+ Re-parent an entity at runtime. Updates the `ParentId` component and reconciles the Three.js scene graph on the same frame. By default (`preserveWorldTransform: true`), world-space position and rotation are preserved by adjusting the local transform:
94
+
95
+ ```ts
96
+ // Attach child to a parent entity (preserves world position)
97
+ oms.setParent(world, childEntityId, parentEntityId);
98
+
99
+ // Detach from parent — make direct child of scene root
100
+ oms.setParent(world, childEntityId, null);
101
+
102
+ // Reparent without preserving world position (local transform reset)
103
+ oms.setParent(world, childEntityId, parentEntityId, { preserveWorldTransform: false });
104
+ ```
105
+
106
+ `setParent` guards against cycles and returns `false` if the operation would create a loop or if either entity does not exist.
107
+
47
108
  - Source: [`core/systems/ObjectManagementSystem.ts`](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/main/core/systems/ObjectManagementSystem.ts)
@@ -55,6 +55,8 @@ export default class Spinner extends Behaviour {
55
55
  | `getEntityByName(name)` | First entity whose `Name` matches, or `null`. |
56
56
  | `getEntitiesByName(name)` | All entities sharing a `Name`. |
57
57
  | `getEntitiesByComponent(component)` | All entities that own a component of the same class. |
58
+ | `getEntitiesChildren(entityId)` | All child entities of the given entity (entities whose `ParentId` component points to this entity). |
59
+ | `getEntitiesParent(entityId)` | The parent entity of the given entity, or `null` if the entity has no parent or is at the world root. |
58
60
 
59
61
  ### Scripts
60
62
 
@@ -102,6 +104,8 @@ Both methods accept `Vec3` (`THREE.Vector3` or `{ x, y, z }`) and return `Inters
102
104
  | `getSystem(SystemClass)` | Resolve a registered system instance. |
103
105
  | `hasSystem(SystemClass)` | `true` if the system is registered. |
104
106
  | `getObjectManagementSystem()` | Shorthand for the built-in `ObjectManagementSystem`. Use this to spawn or destroy entities at runtime (`requestCreate`, `createNow`, `deleteEntity`). |
107
+ | `getEnvironmentComponent()` | Returns the singleton [`Environment`](./scene/environment) component, or `undefined` if not yet initialized. Mutate `values` to change skybox, fog, or gravity at runtime. |
108
+ | `getPostprocessingComponent()` | Returns the singleton [`Postprocessing`](./scene/postprocessing) component, or `undefined` if not yet initialized. Mutate `values` to toggle effects or adjust parameters at runtime. |
105
109
 
106
110
  ### World lifecycle
107
111
 
@@ -148,6 +152,38 @@ export default class FlickerAllLights extends Behaviour {
148
152
  }
149
153
  ```
150
154
 
155
+ ### Navigate the entity hierarchy
156
+
157
+ Use `getEntitiesParent` and `getEntitiesChildren` to traverse parent-child relationships in the scene graph. This is useful for group operations, finding related entities, or building custom hierarchy traversal logic.
158
+
159
+ ```ts
160
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
161
+
162
+ export default class HierarchyWalker extends Behaviour {
163
+ init() {
164
+ // Get the parent of this entity
165
+ const parent = this.world.getEntitiesParent(this.entityId);
166
+ if (parent) {
167
+ console.log(`Parent: ${parent.name} (ID: ${parent.entityId})`);
168
+ }
169
+
170
+ // Get all children of this entity
171
+ const children = this.world.getEntitiesChildren(this.entityId);
172
+ console.log(`Children count: ${children.length}`);
173
+ for (const child of children) {
174
+ console.log(` - ${child.name} (ID: ${child.entityId})`);
175
+ }
176
+
177
+ // Recursively walk up to the root
178
+ let current = this.world.getEntityById(this.entityId);
179
+ while (current) {
180
+ console.log(`Ancestor: ${current.name}`);
181
+ current = this.world.getEntitiesParent(current.entityId);
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
151
187
  ### Talk to another script on a different entity
152
188
 
153
189
  ```ts
@@ -398,6 +434,6 @@ export default class PauseOnHit extends Behaviour {
398
434
  ## See also
399
435
 
400
436
  - [Custom Behaviours](./authoring-a-behaviour) — `init`, `onUpdate`, `dispose`, `data`, lifecycle.
401
- - [Inspector Data Binding](./inspector-data-binding) — exposing fields to the inspector through `data`.
437
+ - [Behaviour Data Binding](./behaviour-data-binding/) — exposing fields to the inspector through `data`.
402
438
  - [Behaviour Lifecycle & Events](./behaviour-lifecycle) — when each hook fires.
403
439
  - [Component Catalog](./component-catalog) — the components you'll read and mutate from scripts.