@relu-interactives/spatial-ecs 0.2.3 → 0.2.4

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 (170) hide show
  1. package/dist/docs/api/Behaviour/classes/Behaviour.md +29 -29
  2. package/dist/docs/api/Component/classes/Component.md +1 -1
  3. package/dist/docs/api/components/classes/AnimationComponent.md +26 -26
  4. package/dist/docs/api/components/classes/AudioComponent.md +19 -19
  5. package/dist/docs/api/components/classes/CameraComponent.md +14 -14
  6. package/dist/docs/api/components/classes/EntityType.md +3 -3
  7. package/dist/docs/api/components/classes/Environment.md +3 -3
  8. package/dist/docs/api/components/classes/ImageComponent.md +7 -7
  9. package/dist/docs/api/components/classes/ImageTarget.md +7 -7
  10. package/dist/docs/api/components/classes/ImageTargetAnchor.md +4 -4
  11. package/dist/docs/api/components/classes/LightComponent.md +6 -6
  12. package/dist/docs/api/components/classes/MaterialComponent.md +11 -11
  13. package/dist/docs/api/components/classes/MeshComponent.md +3 -3
  14. package/dist/docs/api/components/classes/MeshGeometryComponent.md +9 -9
  15. package/dist/docs/api/components/classes/ModelComponent.md +4 -4
  16. package/dist/docs/api/components/classes/Name.md +3 -3
  17. package/dist/docs/api/components/classes/Object3DRef.md +4 -4
  18. package/dist/docs/api/components/classes/ParentId.md +3 -3
  19. package/dist/docs/api/components/classes/PhysicsComponent.md +6 -6
  20. package/dist/docs/api/components/classes/Postprocessing.md +3 -3
  21. package/dist/docs/api/components/classes/ScriptComponent.md +5 -5
  22. package/dist/docs/api/components/classes/Selectable.md +3 -3
  23. package/dist/docs/api/components/classes/SelectionTransformState.md +5 -5
  24. package/dist/docs/api/components/classes/SpriteComponent.md +7 -7
  25. package/dist/docs/api/components/classes/TransformComponent.md +12 -12
  26. package/dist/docs/api/components/classes/VideoComponent.md +28 -28
  27. package/dist/docs/api/components/functions/normalizePhysicsState.md +1 -1
  28. package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +9 -9
  29. package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +13 -13
  30. package/dist/docs/api/components/type-aliases/CameraProjection.md +1 -1
  31. package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +1 -1
  32. package/dist/docs/api/components/type-aliases/ColliderShape.md +1 -1
  33. package/dist/docs/api/components/type-aliases/ColliderState.md +20 -20
  34. package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +4 -4
  35. package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +1 -1
  36. package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +8 -8
  37. package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +1 -1
  38. package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +1 -1
  39. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +7 -7
  40. package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +1 -1
  41. package/dist/docs/api/components/type-aliases/EnvironmentState.md +5 -5
  42. package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +3 -3
  43. package/dist/docs/api/components/type-aliases/ImageTargetReference.md +7 -7
  44. package/dist/docs/api/components/type-aliases/LightValueState.md +11 -11
  45. package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +1 -1
  46. package/dist/docs/api/components/type-aliases/MaterialValueState.md +28 -28
  47. package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +1 -1
  48. package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +7 -7
  49. package/dist/docs/api/components/type-aliases/PhysicsState.md +3 -3
  50. package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +3 -3
  51. package/dist/docs/api/components/type-aliases/PostprocessingState.md +62 -62
  52. package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +3 -3
  53. package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +2 -2
  54. package/dist/docs/api/components/type-aliases/RigidbodyState.md +17 -17
  55. package/dist/docs/api/components/type-aliases/RigidbodyType.md +1 -1
  56. package/dist/docs/api/components/type-aliases/ScriptEntry.md +9 -9
  57. package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +1 -1
  58. package/dist/docs/api/components/type-aliases/TransformData.md +4 -4
  59. package/dist/docs/api/components/type-aliases/TransformModeValue.md +1 -1
  60. package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +1 -1
  61. package/dist/docs/api/components/type-aliases/Vec3.md +4 -4
  62. package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +1 -1
  63. package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +1 -1
  64. package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +1 -1
  65. package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +1 -1
  66. package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +1 -1
  67. package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +1 -1
  68. package/dist/docs/api/index/classes/AnimationStateMachine.md +16 -16
  69. package/dist/docs/api/index/classes/AnimationStateManager.md +13 -13
  70. package/dist/docs/api/index/classes/AnimationSystem.md +3 -3
  71. package/dist/docs/api/index/classes/AudioSystem.md +4 -4
  72. package/dist/docs/api/index/classes/CameraSyncSystem.md +2 -2
  73. package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +4 -4
  74. package/dist/docs/api/index/classes/InputSystem.md +33 -33
  75. package/dist/docs/api/index/classes/LightSyncSystem.md +2 -2
  76. package/dist/docs/api/index/classes/MaterialSyncSystem.md +3 -3
  77. package/dist/docs/api/index/classes/MeshGeometrySystem.md +2 -2
  78. package/dist/docs/api/index/classes/ObjectManagementSystem.md +14 -14
  79. package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +2 -2
  80. package/dist/docs/api/index/classes/PhysicsSyncSystem.md +4 -4
  81. package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +4 -4
  82. package/dist/docs/api/index/classes/RenderSystem.md +3 -3
  83. package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +4 -4
  84. package/dist/docs/api/index/classes/TransformSyncSystem.md +2 -2
  85. package/dist/docs/api/index/classes/VideoSystem.md +4 -4
  86. package/dist/docs/api/index/classes/World.md +95 -81
  87. package/dist/docs/api/index/functions/createAnimationComponent.md +1 -1
  88. package/dist/docs/api/index/functions/createAudioComponent.md +1 -1
  89. package/dist/docs/api/index/functions/createCameraComponent.md +1 -1
  90. package/dist/docs/api/index/functions/createEntityTypeComponent.md +1 -1
  91. package/dist/docs/api/index/functions/createEnvironmentComponent.md +1 -1
  92. package/dist/docs/api/index/functions/createImageComponent.md +1 -1
  93. package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +1 -1
  94. package/dist/docs/api/index/functions/createImageTargetComponent.md +1 -1
  95. package/dist/docs/api/index/functions/createLightComponent.md +1 -1
  96. package/dist/docs/api/index/functions/createMaterialComponent.md +1 -1
  97. package/dist/docs/api/index/functions/createMeshComponent.md +1 -1
  98. package/dist/docs/api/index/functions/createMeshGeometryComponent.md +1 -1
  99. package/dist/docs/api/index/functions/createModelComponent.md +1 -1
  100. package/dist/docs/api/index/functions/createNameComponent.md +1 -1
  101. package/dist/docs/api/index/functions/createObject3DRefComponent.md +1 -1
  102. package/dist/docs/api/index/functions/createParentIdComponent.md +1 -1
  103. package/dist/docs/api/index/functions/createPhysicsComponent.md +1 -1
  104. package/dist/docs/api/index/functions/createPostprocessingComponent.md +1 -1
  105. package/dist/docs/api/index/functions/createScriptComponent.md +1 -1
  106. package/dist/docs/api/index/functions/createSelectableComponent.md +1 -1
  107. package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +1 -1
  108. package/dist/docs/api/index/functions/createSpriteComponent.md +1 -1
  109. package/dist/docs/api/index/functions/createTransformComponent.md +1 -1
  110. package/dist/docs/api/index/functions/createVideoComponent.md +1 -1
  111. package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +1 -1
  112. package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +1 -1
  113. package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +1 -1
  114. package/dist/docs/api/index/functions/registerDefaultFactories.md +1 -1
  115. package/dist/docs/api/index/interfaces/EcsSystem.md +3 -3
  116. package/dist/docs/api/index/interfaces/StateMachine.md +13 -13
  117. package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +4 -4
  118. package/dist/docs/api/index/type-aliases/ComponentFactory.md +1 -1
  119. package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +1 -1
  120. package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +3 -3
  121. package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +4 -4
  122. package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +3 -3
  123. package/dist/docs/api/index/type-aliases/KeyboardKey.md +1 -1
  124. package/dist/docs/api/index/type-aliases/MouseButton.md +1 -1
  125. package/dist/docs/api/index/type-aliases/SelectionContext.md +4 -4
  126. package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +1 -1
  127. package/dist/docs/api/index/variables/KeyboardKeys.md +89 -89
  128. package/dist/docs/api/types/type-aliases/AssetInput.md +3 -3
  129. package/dist/docs/api/types/type-aliases/CheckboxInput.md +1 -1
  130. package/dist/docs/api/types/type-aliases/ColorInput.md +1 -1
  131. package/dist/docs/api/types/type-aliases/ComponentInput.md +4 -4
  132. package/dist/docs/api/types/type-aliases/ComponentKind.md +1 -1
  133. package/dist/docs/api/types/type-aliases/DropdownInput.md +3 -3
  134. package/dist/docs/api/types/type-aliases/DropdownOption.md +3 -3
  135. package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +1 -1
  136. package/dist/docs/api/types/type-aliases/EcsEntityKind.md +1 -1
  137. package/dist/docs/api/types/type-aliases/EntityId.md +1 -1
  138. package/dist/docs/api/types/type-aliases/EntityInput.md +3 -3
  139. package/dist/docs/api/types/type-aliases/FloatInput.md +1 -1
  140. package/dist/docs/api/types/type-aliases/IntersectionResult.md +3 -3
  141. package/dist/docs/api/types/type-aliases/ParentLookup.md +3 -3
  142. package/dist/docs/api/types/type-aliases/SelectionListener.md +1 -1
  143. package/dist/docs/api/types/type-aliases/SliderInput.md +5 -5
  144. package/dist/docs/api/types/type-aliases/TextInput.md +1 -1
  145. package/dist/docs/api/types/type-aliases/ToggleInput.md +1 -1
  146. package/dist/docs/api/types/type-aliases/Vec3.md +1 -1
  147. package/dist/docs/api/types/type-aliases/Vector2Input.md +3 -3
  148. package/dist/docs/api/types/type-aliases/Vector3Input.md +4 -4
  149. package/dist/docs/api/types/type-aliases/WorldEntityView.md +1 -1
  150. package/dist/docs/guide/spawning/ambient-light.md +2 -2
  151. package/dist/docs/guide/spawning/area-light.md +2 -2
  152. package/dist/docs/guide/spawning/audio.md +27 -16
  153. package/dist/docs/guide/spawning/camera.md +2 -2
  154. package/dist/docs/guide/spawning/capsule.md +2 -2
  155. package/dist/docs/guide/spawning/cube.md +2 -2
  156. package/dist/docs/guide/spawning/cylinder.md +2 -2
  157. package/dist/docs/guide/spawning/directional-light.md +2 -2
  158. package/dist/docs/guide/spawning/empty.md +2 -2
  159. package/dist/docs/guide/spawning/image-target.md +2 -2
  160. package/dist/docs/guide/spawning/image.md +2 -2
  161. package/dist/docs/guide/spawning/index.md +2 -2
  162. package/dist/docs/guide/spawning/model.md +2 -2
  163. package/dist/docs/guide/spawning/plane.md +2 -2
  164. package/dist/docs/guide/spawning/point-light.md +2 -2
  165. package/dist/docs/guide/spawning/sphere.md +2 -2
  166. package/dist/docs/guide/spawning/spot-light.md +2 -2
  167. package/dist/docs/guide/spawning/sprite.md +2 -2
  168. package/dist/docs/guide/spawning/video.md +2 -2
  169. package/dist/docs/guide/world-api.md +3 -5
  170. package/package.json +1 -1
@@ -3,11 +3,11 @@
3
3
  A scene-wide light that adds uniform color to every surface. No shadows, no direction.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnAmbient extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("ambientLight", { name: "Fill" });
12
12
  }
13
13
  }
@@ -3,11 +3,11 @@
3
3
  A rectangular area light (`THREE.RectAreaLight`). Great for soft "softbox" lighting. Only `MeshStandardMaterial` and `MeshPhysicalMaterial` are affected.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnSoftbox extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("areaLight", {
12
12
  name: "Softbox",
13
13
  transform: { position: { x: 0, y: 4, z: 0 } },
@@ -3,16 +3,27 @@
3
3
  A 3D positional audio source attached to the active camera's `AudioListener`.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import {
7
+ Behaviour,
8
+
9
+ } from "@relu-interactives/spatial-ecs";
7
10
 
8
11
  export default class SpawnSound extends Behaviour {
9
12
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
13
+ const objects = this.world.getObjectManagementSystem();
11
14
  objects?.requestCreate("audio", {
12
15
  name: "Ambience",
13
16
  path: "/assets/audio/ambience.mp3",
14
17
  transform: { position: { x: 0, y: 1, z: 0 } },
15
- options: { autoplay: true, loop: true, volume: 0.5 },
18
+ options: {
19
+ autoplay: true,
20
+ loop: true,
21
+ volume: 0.5,
22
+ positional: true,
23
+ distanceModel: "linear",
24
+ refDistance: 1,
25
+ rolloffFactor: 1,
26
+ },
16
27
  });
17
28
  }
18
29
  }
@@ -20,22 +31,22 @@ export default class SpawnSound extends Behaviour {
20
31
 
21
32
  ## Payload
22
33
 
23
- | Field | Type | Default | Description |
24
- | --- | --- | --- | --- |
25
- | `name` | `string` | `"Audio"` | Display name. |
26
- | `path` | `string` | `""` | URL or local-asset path to the audio clip (MP3, WAV, OGG). |
27
- | `transform` | `TransformData` | identity | Position / rotation / scale (position drives spatialization). |
28
- | `parentId` | `EntityId \| null` | `null` | Optional parent entity. |
34
+ | Field | Type | Default | Description |
35
+ | ----------- | ------------------ | --------- | ------------------------------------------------------------- |
36
+ | `name` | `string` | `"Audio"` | Display name. |
37
+ | `path` | `string` | `""` | URL or local-asset path to the audio clip (MP3, WAV, OGG). |
38
+ | `transform` | `TransformData` | identity | Position / rotation / scale (position drives spatialization). |
39
+ | `parentId` | `EntityId \| null` | `null` | Optional parent entity. |
29
40
 
30
41
  ### `options`
31
42
 
32
- | Option | Type | Default | Description |
33
- | --- | --- | --- | --- |
34
- | `autoplay` | `boolean` | `false` | Start playback as soon as the clip is loaded. |
35
- | `loop` | `boolean` | `false` | Loop playback indefinitely. |
36
- | `volume` | `number` (0–1) | `1` | Linear gain. |
37
- | `refDistance` | `number` | `1` | Distance at which volume is unattenuated. |
38
- | `rolloffFactor` | `number` | `1` | How quickly volume falls off past `refDistance`. |
43
+ | Option | Type | Default | Description |
44
+ | --------------- | -------------- | ------- | ------------------------------------------------ |
45
+ | `autoplay` | `boolean` | `false` | Start playback as soon as the clip is loaded. |
46
+ | `loop` | `boolean` | `false` | Loop playback indefinitely. |
47
+ | `volume` | `number` (0–1) | `1` | Linear gain. |
48
+ | `refDistance` | `number` | `1` | Distance at which volume is unattenuated. |
49
+ | `rolloffFactor` | `number` | `1` | How quickly volume falls off past `refDistance`. |
39
50
 
40
51
  ## Components attached
41
52
 
@@ -3,11 +3,11 @@
3
3
  Spawn an additional camera entity. Useful for cinematics, picture-in-picture, or AR cameras.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnCamera extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("camera", {
12
12
  name: "Cinematic",
13
13
  transform: { position: { x: 0, y: 2, z: 5 } },
@@ -3,11 +3,11 @@
3
3
  A `THREE.CapsuleGeometry` with radius `0.5`, length `1`, 4 cap subdivisions, and 8 radial segments.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnCapsule extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("capsule", {
12
12
  name: "Player",
13
13
  transform: { position: { x: 0, y: 1, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A unit `1×1×1` `THREE.BoxGeometry` mesh with a default white `MeshStandardMaterial`.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnCube extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("cube", {
12
12
  name: "Crate",
13
13
  transform: { position: { x: 0, y: 1, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A `THREE.CylinderGeometry` with radius `0.5`, height `1`, and 20 radial segments.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnCylinder extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("cylinder", {
12
12
  name: "Pillar",
13
13
  transform: { position: { x: 0, y: 0.5, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A parallel-ray light source — like the sun. Casts shadows by default.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnSun extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("directionalLight", {
12
12
  name: "Sun",
13
13
  transform: { position: { x: 5, y: 8, z: 5 } },
@@ -3,11 +3,11 @@
3
3
  An invisible `THREE.Group`. Useful as a parent / pivot / spawn anchor.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnAnchor extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("empty", {
12
12
  name: "SpawnPoint",
13
13
  transform: { position: { x: 0, y: 0, z: -3 } },
@@ -3,11 +3,11 @@
3
3
  An AR image-tracking anchor. Children of an image-target entity are revealed and aligned when the tracker recognizes the printed image at runtime.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnTarget extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("imageTarget", {
12
12
  name: "PosterTarget",
13
13
  path: "/assets/targets/poster.png",
@@ -3,11 +3,11 @@
3
3
  A flat textured plane that auto-sizes to the loaded image's aspect ratio. Useful for billboards, UI quads, or photo planes.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnPoster extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("image", {
12
12
  name: "Poster",
13
13
  path: "/assets/images/poster.png",
@@ -3,11 +3,11 @@
3
3
  `ObjectManagementSystem` is the runtime factory the editor uses to create every built-in object kind. From inside a `Behaviour` you can ask it to spawn the same primitives at runtime — pre-wired with all of their default components.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class Example extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("cube", { name: "MyCube" }, (entityId) => {
12
12
  console.log("spawned", entityId);
13
13
  });
@@ -3,11 +3,11 @@
3
3
  Loads a glTF / glb model (with optional Draco compression). The entity is created immediately; the model meshes attach asynchronously once the file is loaded.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnModel extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("model", {
12
12
  name: "Robot",
13
13
  path: "/assets/models/robot.glb",
@@ -3,11 +3,11 @@
3
3
  A `100 × 100` double-sided `THREE.PlaneGeometry`. By default it is rotated `-π/2` on the X-axis so it lies flat (XZ ground plane).
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnFloor extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("plane", { name: "Floor" });
12
12
  }
13
13
  }
@@ -3,11 +3,11 @@
3
3
  An omnidirectional light that radiates equally in all directions, with falloff over `distance`.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnTorch extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("pointLight", {
12
12
  name: "Torch",
13
13
  transform: { position: { x: 0, y: 2, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A radius `0.5` `THREE.SphereGeometry` (24 width × 24 height segments) with a default white `MeshStandardMaterial`.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnSphere extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("sphere", {
12
12
  name: "Ball",
13
13
  transform: { position: { x: 0, y: 0.5, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A cone-shaped light with adjustable angle, penumbra, and distance falloff.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnSpot extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("spotLight", {
12
12
  name: "Stage",
13
13
  transform: { position: { x: 0, y: 5, z: 0 } },
@@ -3,11 +3,11 @@
3
3
  A camera-facing `THREE.Sprite` textured with an image. Always faces the active camera.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnIcon extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("sprite", {
12
12
  name: "Marker",
13
13
  path: "/assets/images/marker.png",
@@ -3,11 +3,11 @@
3
3
  A textured plane playing a video file, with optional chroma-keying (green-screen) so you can composite the video over the live scene.
4
4
 
5
5
  ```ts
6
- import { Behaviour, ObjectManagementSystem } from "@relu-interactives/spatial-ecs";
6
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
7
7
 
8
8
  export default class SpawnVideo extends Behaviour {
9
9
  init() {
10
- const objects = this.world.getSystem(ObjectManagementSystem);
10
+ const objects = this.world.getObjectManagementSystem();
11
11
  objects?.requestCreate("video", {
12
12
  name: "Promo",
13
13
  path: "/assets/videos/promo.mp4",
@@ -101,6 +101,7 @@ Both methods accept `Vec3` (`THREE.Vector3` or `{ x, y, z }`) and return `Inters
101
101
  | --- | --- |
102
102
  | `getSystem(SystemClass)` | Resolve a registered system instance. |
103
103
  | `hasSystem(SystemClass)` | `true` if the system is registered. |
104
+ | `getObjectManagementSystem()` | Shorthand for the built-in `ObjectManagementSystem`. Use this to spawn or destroy entities at runtime (`requestCreate`, `createNow`, `deleteEntity`). |
104
105
 
105
106
  ### World lifecycle
106
107
 
@@ -207,14 +208,11 @@ export default class Spawner extends Behaviour {
207
208
  `ObjectManagementSystem` is the same system the editor uses to create objects, so the new entity comes pre-wired with the correct components for its kind.
208
209
 
209
210
  ```ts
210
- import {
211
- Behaviour,
212
- ObjectManagementSystem,
213
- } from "@relu-interactives/spatial-ecs";
211
+ import { Behaviour } from "@relu-interactives/spatial-ecs";
214
212
 
215
213
  export default class CubeSpawner extends Behaviour {
216
214
  init() {
217
- const objects = this.world.getSystem(ObjectManagementSystem);
215
+ const objects = this.world.getObjectManagementSystem();
218
216
  if (!objects) return;
219
217
 
220
218
  // Supported kinds:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relu-interactives/spatial-ecs",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Reusable ECS core engine for Relu Spatial editor and runtime experiences.",
5
5
  "license": "MIT",
6
6
  "private": false,