@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.
- package/README.md +125 -0
- package/dist/System-rXAmagXA.d.cts +659 -0
- package/dist/System-rXAmagXA.d.ts +659 -0
- package/dist/Video-CDemv74U.d.cts +1261 -0
- package/dist/Video-ChKV1UI7.d.ts +1261 -0
- package/dist/assets/draco/draco_decoder.js +34 -0
- package/dist/assets/draco/draco_decoder.wasm +0 -0
- package/dist/assets/draco/draco_wasm_wrapper.js +117 -0
- package/dist/chunk-AYEF3X2P.js +223 -0
- package/dist/chunk-AYEF3X2P.js.map +1 -0
- package/dist/chunk-MAWBTMCG.js +1722 -0
- package/dist/chunk-MAWBTMCG.js.map +1 -0
- package/dist/chunk-NFDTIYR4.js +248 -0
- package/dist/chunk-NFDTIYR4.js.map +1 -0
- package/dist/chunk-OY7ZODZP.js +16 -0
- package/dist/chunk-OY7ZODZP.js.map +1 -0
- package/dist/chunk-P2YDX5DB.js +3304 -0
- package/dist/chunk-P2YDX5DB.js.map +1 -0
- package/dist/chunk-QHILSPT4.js +3 -0
- package/dist/chunk-QHILSPT4.js.map +1 -0
- package/dist/chunk-XWIEEJ7Z.js +1315 -0
- package/dist/chunk-XWIEEJ7Z.js.map +1 -0
- package/dist/components/index.cjs +1745 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +4 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/docs/api/Behaviour/classes/Behaviour.md +554 -0
- package/dist/docs/api/Behaviour/index.md +15 -0
- package/dist/docs/api/Component/classes/Component.md +57 -0
- package/dist/docs/api/Component/index.md +15 -0
- package/dist/docs/api/components/classes/AnimationComponent.md +318 -0
- package/dist/docs/api/components/classes/AudioComponent.md +114 -0
- package/dist/docs/api/components/classes/CameraComponent.md +59 -0
- package/dist/docs/api/components/classes/EntityType.md +48 -0
- package/dist/docs/api/components/classes/Environment.md +47 -0
- package/dist/docs/api/components/classes/ImageComponent.md +57 -0
- package/dist/docs/api/components/classes/ImageTarget.md +60 -0
- package/dist/docs/api/components/classes/ImageTargetAnchor.md +48 -0
- package/dist/docs/api/components/classes/LightComponent.md +70 -0
- package/dist/docs/api/components/classes/MaterialComponent.md +181 -0
- package/dist/docs/api/components/classes/MeshComponent.md +48 -0
- package/dist/docs/api/components/classes/MeshGeometryComponent.md +64 -0
- package/dist/docs/api/components/classes/ModelComponent.md +49 -0
- package/dist/docs/api/components/classes/Name.md +46 -0
- package/dist/docs/api/components/classes/Object3DRef.md +54 -0
- package/dist/docs/api/components/classes/ParentId.md +47 -0
- package/dist/docs/api/components/classes/PhysicsComponent.md +82 -0
- package/dist/docs/api/components/classes/Postprocessing.md +49 -0
- package/dist/docs/api/components/classes/ScriptComponent.md +54 -0
- package/dist/docs/api/components/classes/Selectable.md +46 -0
- package/dist/docs/api/components/classes/SelectionTransformState.md +54 -0
- package/dist/docs/api/components/classes/SpriteComponent.md +55 -0
- package/dist/docs/api/components/classes/TransformComponent.md +197 -0
- package/dist/docs/api/components/classes/VideoComponent.md +123 -0
- package/dist/docs/api/components/functions/normalizePhysicsState.md +23 -0
- package/dist/docs/api/components/index.md +94 -0
- package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +42 -0
- package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +45 -0
- package/dist/docs/api/components/type-aliases/CameraProjection.md +15 -0
- package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +15 -0
- package/dist/docs/api/components/type-aliases/ColliderShape.md +15 -0
- package/dist/docs/api/components/type-aliases/ColliderState.md +62 -0
- package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +27 -0
- package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +37 -0
- package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +34 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +15 -0
- package/dist/docs/api/components/type-aliases/EnvironmentState.md +29 -0
- package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +25 -0
- package/dist/docs/api/components/type-aliases/ImageTargetReference.md +33 -0
- package/dist/docs/api/components/type-aliases/LightValueState.md +41 -0
- package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +15 -0
- package/dist/docs/api/components/type-aliases/MaterialValueState.md +75 -0
- package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +13 -0
- package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +33 -0
- package/dist/docs/api/components/type-aliases/PhysicsState.md +25 -0
- package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +25 -0
- package/dist/docs/api/components/type-aliases/PostprocessingState.md +164 -0
- package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +25 -0
- package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +23 -0
- package/dist/docs/api/components/type-aliases/RigidbodyState.md +53 -0
- package/dist/docs/api/components/type-aliases/RigidbodyType.md +19 -0
- package/dist/docs/api/components/type-aliases/ScriptEntry.md +38 -0
- package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +15 -0
- package/dist/docs/api/components/type-aliases/TransformData.md +27 -0
- package/dist/docs/api/components/type-aliases/TransformModeValue.md +15 -0
- package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +15 -0
- package/dist/docs/api/components/type-aliases/Vec3.md +27 -0
- package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +13 -0
- package/dist/docs/api/index/classes/AnimationStateMachine.md +201 -0
- package/dist/docs/api/index/classes/AnimationStateManager.md +253 -0
- package/dist/docs/api/index/classes/AnimationSystem.md +68 -0
- package/dist/docs/api/index/classes/AudioSystem.md +98 -0
- package/dist/docs/api/index/classes/CameraSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +75 -0
- package/dist/docs/api/index/classes/InputSystem.md +449 -0
- package/dist/docs/api/index/classes/LightSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/MaterialSyncSystem.md +67 -0
- package/dist/docs/api/index/classes/MeshGeometrySystem.md +49 -0
- package/dist/docs/api/index/classes/ObjectManagementSystem.md +298 -0
- package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +49 -0
- package/dist/docs/api/index/classes/PhysicsSyncSystem.md +83 -0
- package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +80 -0
- package/dist/docs/api/index/classes/RenderSystem.md +64 -0
- package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +83 -0
- package/dist/docs/api/index/classes/TransformSyncSystem.md +49 -0
- package/dist/docs/api/index/classes/VideoSystem.md +97 -0
- package/dist/docs/api/index/classes/World.md +1405 -0
- package/dist/docs/api/index/functions/createAnimationComponent.md +28 -0
- package/dist/docs/api/index/functions/createAudioComponent.md +32 -0
- package/dist/docs/api/index/functions/createCameraComponent.md +28 -0
- package/dist/docs/api/index/functions/createEntityTypeComponent.md +28 -0
- package/dist/docs/api/index/functions/createEnvironmentComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +28 -0
- package/dist/docs/api/index/functions/createImageTargetComponent.md +28 -0
- package/dist/docs/api/index/functions/createLightComponent.md +28 -0
- package/dist/docs/api/index/functions/createMaterialComponent.md +28 -0
- package/dist/docs/api/index/functions/createMeshComponent.md +28 -0
- package/dist/docs/api/index/functions/createMeshGeometryComponent.md +28 -0
- package/dist/docs/api/index/functions/createModelComponent.md +28 -0
- package/dist/docs/api/index/functions/createNameComponent.md +28 -0
- package/dist/docs/api/index/functions/createObject3DRefComponent.md +28 -0
- package/dist/docs/api/index/functions/createParentIdComponent.md +28 -0
- package/dist/docs/api/index/functions/createPhysicsComponent.md +30 -0
- package/dist/docs/api/index/functions/createPostprocessingComponent.md +28 -0
- package/dist/docs/api/index/functions/createScriptComponent.md +28 -0
- package/dist/docs/api/index/functions/createSelectableComponent.md +28 -0
- package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +28 -0
- package/dist/docs/api/index/functions/createSpriteComponent.md +28 -0
- package/dist/docs/api/index/functions/createTransformComponent.md +28 -0
- package/dist/docs/api/index/functions/createVideoComponent.md +28 -0
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +28 -0
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +28 -0
- package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +23 -0
- package/dist/docs/api/index/functions/registerDefaultFactories.md +23 -0
- package/dist/docs/api/index/index.md +249 -0
- package/dist/docs/api/index/interfaces/EcsSystem.md +50 -0
- package/dist/docs/api/index/interfaces/StateMachine.md +26 -0
- package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +25 -0
- package/dist/docs/api/index/type-aliases/ComponentFactory.md +25 -0
- package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +37 -0
- package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +26 -0
- package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +25 -0
- package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +23 -0
- package/dist/docs/api/index/type-aliases/KeyboardKey.md +13 -0
- package/dist/docs/api/index/type-aliases/MouseButton.md +13 -0
- package/dist/docs/api/index/type-aliases/SelectionContext.md +31 -0
- package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +13 -0
- package/dist/docs/api/index/variables/KeyboardKeys.md +195 -0
- package/dist/docs/api/index.md +15 -0
- package/dist/docs/api/typedoc-sidebar.json +1 -0
- package/dist/docs/api/types/index.md +34 -0
- package/dist/docs/api/types/type-aliases/AssetInput.md +23 -0
- package/dist/docs/api/types/type-aliases/CheckboxInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ColorInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ComponentInput.md +52 -0
- package/dist/docs/api/types/type-aliases/ComponentKind.md +37 -0
- package/dist/docs/api/types/type-aliases/DropdownInput.md +23 -0
- package/dist/docs/api/types/type-aliases/DropdownOption.md +23 -0
- package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +15 -0
- package/dist/docs/api/types/type-aliases/EcsEntityKind.md +35 -0
- package/dist/docs/api/types/type-aliases/EntityId.md +16 -0
- package/dist/docs/api/types/type-aliases/EntityInput.md +23 -0
- package/dist/docs/api/types/type-aliases/FloatInput.md +13 -0
- package/dist/docs/api/types/type-aliases/IntersectionResult.md +29 -0
- package/dist/docs/api/types/type-aliases/ParentLookup.md +26 -0
- package/dist/docs/api/types/type-aliases/SelectionListener.md +25 -0
- package/dist/docs/api/types/type-aliases/SliderInput.md +27 -0
- package/dist/docs/api/types/type-aliases/TextInput.md +13 -0
- package/dist/docs/api/types/type-aliases/ToggleInput.md +13 -0
- package/dist/docs/api/types/type-aliases/Vec3.md +23 -0
- package/dist/docs/api/types/type-aliases/Vector2Input.md +23 -0
- package/dist/docs/api/types/type-aliases/Vector3Input.md +25 -0
- package/dist/docs/api/types/type-aliases/WorldEntityView.md +17 -0
- package/dist/docs/guide/accessing-components.md +399 -0
- package/dist/docs/guide/authoring-a-behaviour.md +166 -0
- package/dist/docs/guide/behaviour-lifecycle.md +43 -0
- package/dist/docs/guide/component-catalog.md +59 -0
- package/dist/docs/guide/components/_sidebar.json +78 -0
- package/dist/docs/guide/components/animation.md +171 -0
- package/dist/docs/guide/components/audio.md +181 -0
- package/dist/docs/guide/components/camera.md +179 -0
- package/dist/docs/guide/components/entity-type.md +141 -0
- package/dist/docs/guide/components/image-target-anchor.md +103 -0
- package/dist/docs/guide/components/image-target.md +122 -0
- package/dist/docs/guide/components/image.md +146 -0
- package/dist/docs/guide/components/light.md +157 -0
- package/dist/docs/guide/components/material.md +161 -0
- package/dist/docs/guide/components/mesh-geometry.md +153 -0
- package/dist/docs/guide/components/mesh.md +151 -0
- package/dist/docs/guide/components/model.md +96 -0
- package/dist/docs/guide/components/name.md +121 -0
- package/dist/docs/guide/components/object3d-ref.md +115 -0
- package/dist/docs/guide/components/parent-id.md +108 -0
- package/dist/docs/guide/components/physics.md +163 -0
- package/dist/docs/guide/components/script.md +142 -0
- package/dist/docs/guide/components/sprite.md +155 -0
- package/dist/docs/guide/components/transform.md +155 -0
- package/dist/docs/guide/components/video.md +153 -0
- package/dist/docs/guide/concepts.md +34 -0
- package/dist/docs/guide/getting-started/creating-objects.md +50 -0
- package/dist/docs/guide/getting-started/editing-objects.md +62 -0
- package/dist/docs/guide/getting-started/editor/assets-browser.md +55 -0
- package/dist/docs/guide/getting-started/editor/hierarchy.md +47 -0
- package/dist/docs/guide/getting-started/editor/index.md +16 -0
- package/dist/docs/guide/getting-started/editor/inspector.md +36 -0
- package/dist/docs/guide/getting-started/editor/modules.md +35 -0
- package/dist/docs/guide/getting-started/editor/scene-inspector.md +64 -0
- package/dist/docs/guide/getting-started/editor/toolbar.md +39 -0
- package/dist/docs/guide/getting-started/editor/viewport.md +43 -0
- package/dist/docs/guide/getting-started/first-launch.md +17 -0
- package/dist/docs/guide/getting-started/index.md +37 -0
- package/dist/docs/guide/getting-started/installation.md +59 -0
- package/dist/docs/guide/getting-started/preview-and-test.md +55 -0
- package/dist/docs/guide/getting-started/project-types/3d.md +30 -0
- package/dist/docs/guide/getting-started/project-types/ar.md +6 -0
- package/dist/docs/guide/getting-started/project-types/face-tracking.md +6 -0
- package/dist/docs/guide/getting-started/project-types/image-tracking.md +42 -0
- package/dist/docs/guide/getting-started/project-types/index.md +25 -0
- package/dist/docs/guide/getting-started/project-types/vr.md +6 -0
- package/dist/docs/guide/getting-started/projects.md +53 -0
- package/dist/docs/guide/getting-started/shortcuts.md +43 -0
- package/dist/docs/guide/inspector-data-binding.md +367 -0
- package/dist/docs/guide/reading-input.md +202 -0
- package/dist/docs/guide/scene/environment.md +101 -0
- package/dist/docs/guide/scene/index.md +36 -0
- package/dist/docs/guide/scene/postprocessing.md +108 -0
- package/dist/docs/guide/spawning/ambient-light.md +28 -0
- package/dist/docs/guide/spawning/area-light.md +32 -0
- package/dist/docs/guide/spawning/audio.md +42 -0
- package/dist/docs/guide/spawning/camera.md +50 -0
- package/dist/docs/guide/spawning/capsule.md +29 -0
- package/dist/docs/guide/spawning/cube.md +31 -0
- package/dist/docs/guide/spawning/cylinder.md +29 -0
- package/dist/docs/guide/spawning/directional-light.md +32 -0
- package/dist/docs/guide/spawning/empty.md +31 -0
- package/dist/docs/guide/spawning/image-target.md +48 -0
- package/dist/docs/guide/spawning/image.md +33 -0
- package/dist/docs/guide/spawning/index.md +79 -0
- package/dist/docs/guide/spawning/model.md +31 -0
- package/dist/docs/guide/spawning/plane.md +31 -0
- package/dist/docs/guide/spawning/point-light.md +32 -0
- package/dist/docs/guide/spawning/sphere.md +29 -0
- package/dist/docs/guide/spawning/spot-light.md +32 -0
- package/dist/docs/guide/spawning/sprite.md +31 -0
- package/dist/docs/guide/spawning/video.md +53 -0
- package/dist/docs/guide/system-overview.md +73 -0
- package/dist/docs/guide/systems/_sidebar.json +66 -0
- package/dist/docs/guide/systems/animation-system.md +32 -0
- package/dist/docs/guide/systems/audio-system.md +28 -0
- package/dist/docs/guide/systems/camera-sync-system.md +31 -0
- package/dist/docs/guide/systems/environment-sync-system.md +31 -0
- package/dist/docs/guide/systems/input-system.md +217 -0
- package/dist/docs/guide/systems/light-sync-system.md +29 -0
- package/dist/docs/guide/systems/material-sync-system.md +32 -0
- package/dist/docs/guide/systems/mesh-geometry-system.md +40 -0
- package/dist/docs/guide/systems/object-management-system.md +38 -0
- package/dist/docs/guide/systems/object-visibility-system.md +26 -0
- package/dist/docs/guide/systems/physics-sync-system.md +56 -0
- package/dist/docs/guide/systems/postprocessing-sync-system.md +43 -0
- package/dist/docs/guide/systems/render-system.md +22 -0
- package/dist/docs/guide/systems/script-behaviour-system.md +59 -0
- package/dist/docs/guide/systems/transform-sync-system.md +29 -0
- package/dist/docs/guide/systems/video-system.md +30 -0
- package/dist/docs/guide/world-api.md +405 -0
- package/dist/factories/index.cjs +3077 -0
- package/dist/factories/index.cjs.map +1 -0
- package/dist/factories/index.d.cts +69 -0
- package/dist/factories/index.d.ts +69 -0
- package/dist/factories/index.js +6 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/index-B4-YyUNR.d.cts +73 -0
- package/dist/index-BZUOKeTO.d.ts +73 -0
- package/dist/index.cjs +8584 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +283 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +1729 -0
- package/dist/index.js.map +1 -0
- package/dist/systems/index.cjs +5119 -0
- package/dist/systems/index.cjs.map +1 -0
- package/dist/systems/index.d.cts +200 -0
- package/dist/systems/index.d.ts +200 -0
- package/dist/systems/index.js +6 -0
- package/dist/systems/index.js.map +1 -0
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +3 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/worldSnapshotUtils.cjs +259 -0
- package/dist/worldSnapshotUtils.cjs.map +1 -0
- package/dist/worldSnapshotUtils.d.cts +3 -0
- package/dist/worldSnapshotUtils.d.ts +3 -0
- package/dist/worldSnapshotUtils.js +4 -0
- package/dist/worldSnapshotUtils.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
[**@relu-interactives/spatial-ecs**](../../index.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@relu-interactives/spatial-ecs](../../index.md) / [Behaviour](../index.md) / Behaviour
|
|
6
|
+
|
|
7
|
+
# Class: Behaviour
|
|
8
|
+
|
|
9
|
+
Defined in: [Behaviour.ts:62](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L62)
|
|
10
|
+
|
|
11
|
+
Base class for all user-authored scripts attached to an entity through a
|
|
12
|
+
`ScriptComponent`. Subclass `Behaviour` to drive per-frame logic on a single
|
|
13
|
+
entity with full access to the [World](../../index/classes/World.md), the entity's
|
|
14
|
+
[TransformComponent](../../components/classes/TransformComponent.md), and its three.js [Object3DRef](../../components/classes/Object3DRef.md).
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
Scripts are dispatched by `ScriptBehaviourSystem` once per frame in this
|
|
19
|
+
order: [Behaviour.init](#init) (first frame only) → [Behaviour.onUpdate](#onupdate).
|
|
20
|
+
Override [Behaviour.onUpdate](#onupdate) for per-frame logic — never override
|
|
21
|
+
[Behaviour.update](#update), which is the engine-managed entry point.
|
|
22
|
+
|
|
23
|
+
**Editor scripts**: By default, `Behaviour` subclasses do not run inside the
|
|
24
|
+
editor. Set `executeInEditor: true` on the script entry in the inspector to
|
|
25
|
+
enable the full lifecycle (`init` → `onUpdate` → `dispose`) while the editor
|
|
26
|
+
is open. This gives direct access to the Three.js scene, camera, and renderer
|
|
27
|
+
via [World.getScene](../../index/classes/World.md#getscene), [World.getCamera](../../index/classes/World.md#getcamera), and
|
|
28
|
+
[World.getRenderer](../../index/classes/World.md#getrenderer) — useful for custom shaders, procedural geometry,
|
|
29
|
+
grass, and any Three.js feature the editor's object palette does not expose.
|
|
30
|
+
Avoid mutating ECS component state every frame in editor mode, as it creates
|
|
31
|
+
undo history entries on every tick.
|
|
32
|
+
|
|
33
|
+
The runtime recognizes a script by its **default export** plus the
|
|
34
|
+
inherited static marker `__reluBehaviourClass`. Do not override the marker.
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Behaviour, type Component } from "@relu-interactives/spatial-ecs";
|
|
40
|
+
|
|
41
|
+
export default class Spinner extends Behaviour {
|
|
42
|
+
data: {
|
|
43
|
+
speed: number;
|
|
44
|
+
axis: "x" | "y" | "z";
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
init() {
|
|
48
|
+
this.data.speed ??= 1;
|
|
49
|
+
this.data.axis ??= "y";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onUpdate() {
|
|
53
|
+
this.transform.rotation[this.data.axis] += this.data.speed * this.deltaTime;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## See
|
|
59
|
+
|
|
60
|
+
- [World](../../index/classes/World.md)
|
|
61
|
+
- [TransformComponent](../../components/classes/TransformComponent.md)
|
|
62
|
+
- [Object3DRef](../../components/classes/Object3DRef.md)
|
|
63
|
+
|
|
64
|
+
## Implements
|
|
65
|
+
|
|
66
|
+
- `CustomEcsSystem`
|
|
67
|
+
|
|
68
|
+
## Constructors
|
|
69
|
+
|
|
70
|
+
### Constructor
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
new Behaviour(
|
|
74
|
+
world,
|
|
75
|
+
entityId,
|
|
76
|
+
component): Behaviour;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Defined in: [Behaviour.ts:120](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L120)
|
|
80
|
+
|
|
81
|
+
Engine-managed constructor. Hosts (`ScriptBehaviourSystem`) instantiate
|
|
82
|
+
subclasses with the owning world, the entity id, and the script's `data`
|
|
83
|
+
payload. User code should not call this directly.
|
|
84
|
+
|
|
85
|
+
#### Parameters
|
|
86
|
+
|
|
87
|
+
| Parameter | Type | Description |
|
|
88
|
+
| ------ | ------ | ------ |
|
|
89
|
+
| `world` | [`World`](../../index/classes/World.md) | The owning ECS world. |
|
|
90
|
+
| `entityId` | `number` | The entity this script is bound to. |
|
|
91
|
+
| `component` | \| [`Component`](../../Component/classes/Component.md) \| `Record`\<`string`, `unknown`\> | The `ScriptComponent.data` payload, or any object that should be exposed to the script as `this.data`. |
|
|
92
|
+
|
|
93
|
+
#### Returns
|
|
94
|
+
|
|
95
|
+
`Behaviour`
|
|
96
|
+
|
|
97
|
+
## Properties
|
|
98
|
+
|
|
99
|
+
| Property | Type | Default value | Description | Defined in |
|
|
100
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
101
|
+
| <a id="data"></a> `data` | \| [`Component`](../../Component/classes/Component.md) \| `Record`\<`string`, `unknown`\> | `undefined` | Inspector-bound payload from the entity's `ScriptComponent`. Override the type on subclasses with `declare data: MyDataShape` to get type safety inside hooks. Saved with the project so values persist across reloads. | [Behaviour.ts:78](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L78) |
|
|
102
|
+
| <a id="entityid"></a> `entityId` | `number` | `undefined` | Numeric id of the entity this script is attached to. | [Behaviour.ts:81](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L81) |
|
|
103
|
+
| <a id="entity"></a> `entity` | `WorldEntityView` | `undefined` | View of the owning entity (id + components) at construction time. | [Behaviour.ts:84](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L84) |
|
|
104
|
+
| <a id="threeref"></a> `threeRef` | [`Object3DRef`](../../components/classes/Object3DRef.md) | `undefined` | Live three.js object wrapper for the entity. May be `null` for entities with no scene presence; helpers on this class return `null` in that case. | [Behaviour.ts:90](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L90) |
|
|
105
|
+
| <a id="transform"></a> `transform` | [`TransformComponent`](../../components/classes/TransformComponent.md) | `undefined` | The entity's [TransformComponent](../../components/classes/TransformComponent.md). Mutating `position`, `rotation`, or `scale` here is picked up the same frame by `TransformSyncSystem`. | [Behaviour.ts:96](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L96) |
|
|
106
|
+
| <a id="world"></a> `world` | [`World`](../../index/classes/World.md) | `undefined` | The owning [World](../../index/classes/World.md). Refreshed each frame in [Behaviour.update](#update). Use it to query other entities or components. | [Behaviour.ts:102](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L102) |
|
|
107
|
+
| <a id="deltatime"></a> `deltaTime` | `number` | `0` | Seconds elapsed since the last frame. Set by the engine before each [Behaviour.onUpdate](#onupdate). | [Behaviour.ts:108](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L108) |
|
|
108
|
+
|
|
109
|
+
## Methods
|
|
110
|
+
|
|
111
|
+
### update()
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
update(world, deltaTime): void;
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Defined in: [Behaviour.ts:144](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L144)
|
|
118
|
+
|
|
119
|
+
Engine-managed per-frame entry point. Refreshes [Behaviour.deltaTime](#deltatime)
|
|
120
|
+
and delegates to [Behaviour.onUpdate](#onupdate).
|
|
121
|
+
|
|
122
|
+
#### Parameters
|
|
123
|
+
|
|
124
|
+
| Parameter | Type | Description |
|
|
125
|
+
| ------ | ------ | ------ |
|
|
126
|
+
| `world` | [`World`](../../index/classes/World.md) | The owning world (may differ from the constructor world after hot reload). |
|
|
127
|
+
| `deltaTime` | `number` | Seconds since the last frame. |
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`void`
|
|
132
|
+
|
|
133
|
+
#### Remarks
|
|
134
|
+
|
|
135
|
+
Do **not** override this method — override
|
|
136
|
+
[Behaviour.onUpdate](#onupdate) instead.
|
|
137
|
+
|
|
138
|
+
#### Implementation of
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
CustomEcsSystem.update
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
***
|
|
145
|
+
|
|
146
|
+
### dispose()?
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
optional dispose(world): void;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Defined in: [Behaviour.ts:156](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L156)
|
|
153
|
+
|
|
154
|
+
Optional cleanup hook invoked when the script is detached or the entity
|
|
155
|
+
is destroyed. Override to release timers, listeners, or other resources.
|
|
156
|
+
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
| Parameter | Type | Description |
|
|
160
|
+
| ------ | ------ | ------ |
|
|
161
|
+
| `world` | [`World`](../../index/classes/World.md) | The owning world at disposal time. |
|
|
162
|
+
|
|
163
|
+
#### Returns
|
|
164
|
+
|
|
165
|
+
`void`
|
|
166
|
+
|
|
167
|
+
#### Implementation of
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
CustomEcsSystem.dispose
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
175
|
+
### getWorldPosition()
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
getWorldPosition(): Vector3 | null;
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Defined in: [Behaviour.ts:164](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L164)
|
|
182
|
+
|
|
183
|
+
Returns the entity's world-space position as a new `THREE.Vector3`, or
|
|
184
|
+
`null` if the entity has no scene presence.
|
|
185
|
+
|
|
186
|
+
#### Returns
|
|
187
|
+
|
|
188
|
+
`Vector3` \| `null`
|
|
189
|
+
|
|
190
|
+
***
|
|
191
|
+
|
|
192
|
+
### getWorldDirection()
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
getWorldDirection(): Vector3 | null;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Defined in: [Behaviour.ts:179](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L179)
|
|
199
|
+
|
|
200
|
+
Returns the entity's forward direction in world space (the +Z axis of its
|
|
201
|
+
world matrix), or `null` if the entity has no scene presence.
|
|
202
|
+
|
|
203
|
+
#### Returns
|
|
204
|
+
|
|
205
|
+
`Vector3` \| `null`
|
|
206
|
+
|
|
207
|
+
***
|
|
208
|
+
|
|
209
|
+
### directionTo()
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
directionTo(targetPosition): Vector3 | null;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Defined in: [Behaviour.ts:196](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L196)
|
|
216
|
+
|
|
217
|
+
Returns a unit vector pointing from this entity toward the given world
|
|
218
|
+
position, or `null` if the entity has no scene presence.
|
|
219
|
+
|
|
220
|
+
#### Parameters
|
|
221
|
+
|
|
222
|
+
| Parameter | Type | Description |
|
|
223
|
+
| ------ | ------ | ------ |
|
|
224
|
+
| `targetPosition` | `Vector3` | Destination point in world space. |
|
|
225
|
+
|
|
226
|
+
#### Returns
|
|
227
|
+
|
|
228
|
+
`Vector3` \| `null`
|
|
229
|
+
|
|
230
|
+
***
|
|
231
|
+
|
|
232
|
+
### distanceTo()
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
distanceTo(targetPosition): number | null;
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Defined in: [Behaviour.ts:211](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L211)
|
|
239
|
+
|
|
240
|
+
Returns the world-space distance from this entity to the given position,
|
|
241
|
+
or `null` if the entity has no scene presence.
|
|
242
|
+
|
|
243
|
+
#### Parameters
|
|
244
|
+
|
|
245
|
+
| Parameter | Type | Description |
|
|
246
|
+
| ------ | ------ | ------ |
|
|
247
|
+
| `targetPosition` | `Vector3` | Destination point in world space. |
|
|
248
|
+
|
|
249
|
+
#### Returns
|
|
250
|
+
|
|
251
|
+
`number` \| `null`
|
|
252
|
+
|
|
253
|
+
***
|
|
254
|
+
|
|
255
|
+
### lerpTo()
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
lerpTo(targetPosition, alpha): void;
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Defined in: [Behaviour.ts:229](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L229)
|
|
262
|
+
|
|
263
|
+
Linearly interpolates the entity's position toward `targetPosition` and
|
|
264
|
+
writes the result back through [TransformComponent](../../components/classes/TransformComponent.md). No-op if the
|
|
265
|
+
entity has no scene presence.
|
|
266
|
+
|
|
267
|
+
#### Parameters
|
|
268
|
+
|
|
269
|
+
| Parameter | Type | Description |
|
|
270
|
+
| ------ | ------ | ------ |
|
|
271
|
+
| `targetPosition` | `Vector3` | Destination point in world space. |
|
|
272
|
+
| `alpha` | `number` | Interpolation factor in [0, 1]. Multiply by `deltaTime` for frame-rate-independent smoothing. |
|
|
273
|
+
|
|
274
|
+
#### Returns
|
|
275
|
+
|
|
276
|
+
`void`
|
|
277
|
+
|
|
278
|
+
***
|
|
279
|
+
|
|
280
|
+
### slerpTo()
|
|
281
|
+
|
|
282
|
+
```ts
|
|
283
|
+
slerpTo(targetRotation, alpha): void;
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Defined in: [Behaviour.ts:251](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L251)
|
|
287
|
+
|
|
288
|
+
Spherically interpolates the entity's rotation toward `targetRotation`
|
|
289
|
+
and writes the result back through [TransformComponent](../../components/classes/TransformComponent.md). No-op if
|
|
290
|
+
the entity has no scene presence.
|
|
291
|
+
|
|
292
|
+
#### Parameters
|
|
293
|
+
|
|
294
|
+
| Parameter | Type | Description |
|
|
295
|
+
| ------ | ------ | ------ |
|
|
296
|
+
| `targetRotation` | `Quaternion` | Destination orientation as a quaternion. |
|
|
297
|
+
| `alpha` | `number` | Interpolation factor in [0, 1]. |
|
|
298
|
+
|
|
299
|
+
#### Returns
|
|
300
|
+
|
|
301
|
+
`void`
|
|
302
|
+
|
|
303
|
+
***
|
|
304
|
+
|
|
305
|
+
### lookAt()
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
lookAt(targetPosition): void;
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Defined in: [Behaviour.ts:270](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L270)
|
|
312
|
+
|
|
313
|
+
Rotates the entity to face `targetPosition` in world space and writes the
|
|
314
|
+
resulting orientation back through [TransformComponent](../../components/classes/TransformComponent.md). No-op if
|
|
315
|
+
the entity has no scene presence.
|
|
316
|
+
|
|
317
|
+
#### Parameters
|
|
318
|
+
|
|
319
|
+
| Parameter | Type | Description |
|
|
320
|
+
| ------ | ------ | ------ |
|
|
321
|
+
| `targetPosition` | `Vector3` | Point in world space to face. |
|
|
322
|
+
|
|
323
|
+
#### Returns
|
|
324
|
+
|
|
325
|
+
`void`
|
|
326
|
+
|
|
327
|
+
***
|
|
328
|
+
|
|
329
|
+
### getComponents()
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
getComponents(): Component[];
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Defined in: [Behaviour.ts:284](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L284)
|
|
336
|
+
|
|
337
|
+
Returns every component currently attached to this entity.
|
|
338
|
+
|
|
339
|
+
#### Returns
|
|
340
|
+
|
|
341
|
+
[`Component`](../../Component/classes/Component.md)[]
|
|
342
|
+
|
|
343
|
+
***
|
|
344
|
+
|
|
345
|
+
### getComponent()
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
getComponent<T>(componentClass): T | null;
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Defined in: [Behaviour.ts:301](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L301)
|
|
352
|
+
|
|
353
|
+
Returns the entity's component of the given class, or `null` if it has
|
|
354
|
+
no such component.
|
|
355
|
+
|
|
356
|
+
#### Type Parameters
|
|
357
|
+
|
|
358
|
+
| Type Parameter | Description |
|
|
359
|
+
| ------ | ------ |
|
|
360
|
+
| `T` *extends* [`Component`](../../Component/classes/Component.md) | Concrete component type. |
|
|
361
|
+
|
|
362
|
+
#### Parameters
|
|
363
|
+
|
|
364
|
+
| Parameter | Type | Description |
|
|
365
|
+
| ------ | ------ | ------ |
|
|
366
|
+
| `componentClass` | `ComponentClass`\<`T`\> | Component class constructor to look up. |
|
|
367
|
+
|
|
368
|
+
#### Returns
|
|
369
|
+
|
|
370
|
+
`T` \| `null`
|
|
371
|
+
|
|
372
|
+
#### Example
|
|
373
|
+
|
|
374
|
+
```ts
|
|
375
|
+
const mesh = this.getComponent(MeshComponent);
|
|
376
|
+
if (mesh) console.log(mesh.geometryRef);
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
***
|
|
380
|
+
|
|
381
|
+
### getEntity()
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
getEntity(): WorldEntityView | null;
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Defined in: [Behaviour.ts:311](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L311)
|
|
388
|
+
|
|
389
|
+
Returns the latest [WorldEntityView](../../types/type-aliases/WorldEntityView.md) snapshot for this entity, or
|
|
390
|
+
`null` if it was destroyed.
|
|
391
|
+
|
|
392
|
+
#### Returns
|
|
393
|
+
|
|
394
|
+
`WorldEntityView` \| `null`
|
|
395
|
+
|
|
396
|
+
***
|
|
397
|
+
|
|
398
|
+
### getParent()
|
|
399
|
+
|
|
400
|
+
```ts
|
|
401
|
+
getParent(): ParentLookup;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Defined in: [Behaviour.ts:321](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L321)
|
|
405
|
+
|
|
406
|
+
Resolves the entity's parent from the [ParentId](../../components/classes/ParentId.md) component, if any.
|
|
407
|
+
|
|
408
|
+
#### Returns
|
|
409
|
+
|
|
410
|
+
[`ParentLookup`](../../types/type-aliases/ParentLookup.md)
|
|
411
|
+
|
|
412
|
+
A [ParentLookup](../../types/type-aliases/ParentLookup.md) with the parent component reference and
|
|
413
|
+
the parent entity view (or `null` if the entity is at the root).
|
|
414
|
+
|
|
415
|
+
***
|
|
416
|
+
|
|
417
|
+
### getChildren()
|
|
418
|
+
|
|
419
|
+
```ts
|
|
420
|
+
getChildren(): WorldEntityView[];
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Defined in: [Behaviour.ts:342](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L342)
|
|
424
|
+
|
|
425
|
+
Returns every direct child entity of this one (entities whose
|
|
426
|
+
[ParentId](../../components/classes/ParentId.md) matches `entityId`).
|
|
427
|
+
|
|
428
|
+
#### Returns
|
|
429
|
+
|
|
430
|
+
`WorldEntityView`[]
|
|
431
|
+
|
|
432
|
+
***
|
|
433
|
+
|
|
434
|
+
### init()
|
|
435
|
+
|
|
436
|
+
```ts
|
|
437
|
+
protected init(): void;
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Defined in: [Behaviour.ts:361](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L361)
|
|
441
|
+
|
|
442
|
+
Called once before the first [Behaviour.onUpdate](#onupdate). Override to
|
|
443
|
+
default and validate [Behaviour.data](#data), cache references, or set
|
|
444
|
+
initial state.
|
|
445
|
+
|
|
446
|
+
#### Returns
|
|
447
|
+
|
|
448
|
+
`void`
|
|
449
|
+
|
|
450
|
+
#### Remarks
|
|
451
|
+
|
|
452
|
+
Also called in editor mode when `executeInEditor` is `true` on the script
|
|
453
|
+
entry.
|
|
454
|
+
|
|
455
|
+
***
|
|
456
|
+
|
|
457
|
+
### onUpdate()
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
protected onUpdate(): void;
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
Defined in: [Behaviour.ts:374](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L374)
|
|
464
|
+
|
|
465
|
+
Called every frame while the script is enabled. Override with the
|
|
466
|
+
script's main per-frame logic.
|
|
467
|
+
|
|
468
|
+
#### Returns
|
|
469
|
+
|
|
470
|
+
`void`
|
|
471
|
+
|
|
472
|
+
#### Remarks
|
|
473
|
+
|
|
474
|
+
Also called every frame in editor mode when `executeInEditor` is `true`.
|
|
475
|
+
Access the Three.js scene with `this.world.getScene()` for editor-only
|
|
476
|
+
rendering work such as custom shaders or procedural geometry.
|
|
477
|
+
|
|
478
|
+
***
|
|
479
|
+
|
|
480
|
+
### onSelect()
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
onSelect(): void;
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Defined in: [Behaviour.ts:379](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L379)
|
|
487
|
+
|
|
488
|
+
Called when the editor selects this entity. Optional UX hook.
|
|
489
|
+
|
|
490
|
+
#### Returns
|
|
491
|
+
|
|
492
|
+
`void`
|
|
493
|
+
|
|
494
|
+
***
|
|
495
|
+
|
|
496
|
+
### onDeselect()
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
onDeselect(): void;
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Defined in: [Behaviour.ts:384](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L384)
|
|
503
|
+
|
|
504
|
+
Called when the editor deselects this entity. Optional UX hook.
|
|
505
|
+
|
|
506
|
+
#### Returns
|
|
507
|
+
|
|
508
|
+
`void`
|
|
509
|
+
|
|
510
|
+
***
|
|
511
|
+
|
|
512
|
+
### onTargetFound()
|
|
513
|
+
|
|
514
|
+
```ts
|
|
515
|
+
onTargetFound(target): void;
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Defined in: [Behaviour.ts:394](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L394)
|
|
519
|
+
|
|
520
|
+
Called when an image-tracking target this entity depends on becomes
|
|
521
|
+
visible. Optional AR hook.
|
|
522
|
+
|
|
523
|
+
#### Parameters
|
|
524
|
+
|
|
525
|
+
| Parameter | Type | Description |
|
|
526
|
+
| ------ | ------ | ------ |
|
|
527
|
+
| `target` | `WorldEntityView` | The newly-visible target entity view. |
|
|
528
|
+
|
|
529
|
+
#### Returns
|
|
530
|
+
|
|
531
|
+
`void`
|
|
532
|
+
|
|
533
|
+
***
|
|
534
|
+
|
|
535
|
+
### onTargetLost()
|
|
536
|
+
|
|
537
|
+
```ts
|
|
538
|
+
onTargetLost(target): void;
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Defined in: [Behaviour.ts:404](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Behaviour.ts#L404)
|
|
542
|
+
|
|
543
|
+
Called when an image-tracking target this entity depends on is lost.
|
|
544
|
+
Optional AR hook.
|
|
545
|
+
|
|
546
|
+
#### Parameters
|
|
547
|
+
|
|
548
|
+
| Parameter | Type | Description |
|
|
549
|
+
| ------ | ------ | ------ |
|
|
550
|
+
| `target` | `WorldEntityView` | The target entity view that became invisible. |
|
|
551
|
+
|
|
552
|
+
#### Returns
|
|
553
|
+
|
|
554
|
+
`void`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[**@relu-interactives/spatial-ecs**](../index.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@relu-interactives/spatial-ecs](../index.md) / Behaviour
|
|
6
|
+
|
|
7
|
+
# Behaviour
|
|
8
|
+
|
|
9
|
+
## Classes
|
|
10
|
+
|
|
11
|
+
### Scripting
|
|
12
|
+
|
|
13
|
+
| Class | Description |
|
|
14
|
+
| ------ | ------ |
|
|
15
|
+
| [Behaviour](classes/Behaviour.md) | Base class for all user-authored scripts attached to an entity through a `ScriptComponent`. Subclass `Behaviour` to drive per-frame logic on a single entity with full access to the [World](../index/classes/World.md), the entity's [TransformComponent](../components/classes/TransformComponent.md), and its three.js [Object3DRef](../components/classes/Object3DRef.md). |
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[**@relu-interactives/spatial-ecs**](../../index.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@relu-interactives/spatial-ecs](../../index.md) / [Component](../index.md) / Component
|
|
6
|
+
|
|
7
|
+
# Class: Component
|
|
8
|
+
|
|
9
|
+
Defined in: [Component.ts:12](https://github.com/Relu-Interactives/relu-spatial-ecs-engine/blob/d7abe871a8dd71d2e6e1dff3235da21d5376bd8f/core/Component.ts#L12)
|
|
10
|
+
|
|
11
|
+
Marker base class for every ECS component. Subclass `Component` to declare
|
|
12
|
+
a typed data container that systems can query.
|
|
13
|
+
|
|
14
|
+
## Remarks
|
|
15
|
+
|
|
16
|
+
Components own state only — runtime behaviour belongs in [Behaviour](../../Behaviour/index.md)
|
|
17
|
+
subclasses for user scripts. Keep fields plain (numbers, strings, vectors,
|
|
18
|
+
asset URLs).
|
|
19
|
+
|
|
20
|
+
## Extended by
|
|
21
|
+
|
|
22
|
+
- [`AnimationComponent`](../../components/classes/AnimationComponent.md)
|
|
23
|
+
- [`CameraComponent`](../../components/classes/CameraComponent.md)
|
|
24
|
+
- [`AudioComponent`](../../components/classes/AudioComponent.md)
|
|
25
|
+
- [`Environment`](../../components/classes/Environment.md)
|
|
26
|
+
- [`Postprocessing`](../../components/classes/Postprocessing.md)
|
|
27
|
+
- [`PhysicsComponent`](../../components/classes/PhysicsComponent.md)
|
|
28
|
+
- [`EntityType`](../../components/classes/EntityType.md)
|
|
29
|
+
- [`ImageComponent`](../../components/classes/ImageComponent.md)
|
|
30
|
+
- [`ImageTarget`](../../components/classes/ImageTarget.md)
|
|
31
|
+
- [`ImageTargetAnchor`](../../components/classes/ImageTargetAnchor.md)
|
|
32
|
+
- [`LightComponent`](../../components/classes/LightComponent.md)
|
|
33
|
+
- [`MaterialComponent`](../../components/classes/MaterialComponent.md)
|
|
34
|
+
- [`MeshComponent`](../../components/classes/MeshComponent.md)
|
|
35
|
+
- [`MeshGeometryComponent`](../../components/classes/MeshGeometryComponent.md)
|
|
36
|
+
- [`ModelComponent`](../../components/classes/ModelComponent.md)
|
|
37
|
+
- [`Name`](../../components/classes/Name.md)
|
|
38
|
+
- [`Object3DRef`](../../components/classes/Object3DRef.md)
|
|
39
|
+
- [`ParentId`](../../components/classes/ParentId.md)
|
|
40
|
+
- [`ScriptComponent`](../../components/classes/ScriptComponent.md)
|
|
41
|
+
- [`Selectable`](../../components/classes/Selectable.md)
|
|
42
|
+
- [`SpriteComponent`](../../components/classes/SpriteComponent.md)
|
|
43
|
+
- [`SelectionTransformState`](../../components/classes/SelectionTransformState.md)
|
|
44
|
+
- [`TransformComponent`](../../components/classes/TransformComponent.md)
|
|
45
|
+
- [`VideoComponent`](../../components/classes/VideoComponent.md)
|
|
46
|
+
|
|
47
|
+
## Constructors
|
|
48
|
+
|
|
49
|
+
### Constructor
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
new Component(): Component;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`Component`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[**@relu-interactives/spatial-ecs**](../index.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@relu-interactives/spatial-ecs](../index.md) / Component
|
|
6
|
+
|
|
7
|
+
# Component
|
|
8
|
+
|
|
9
|
+
## Classes
|
|
10
|
+
|
|
11
|
+
### Components
|
|
12
|
+
|
|
13
|
+
| Class | Description |
|
|
14
|
+
| ------ | ------ |
|
|
15
|
+
| [Component](classes/Component.md) | Marker base class for every ECS component. Subclass `Component` to declare a typed data container that systems can query. |
|