@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components
components ​
Classes ​
Components ​
| Class | Description |
|---|---|
| AnimationComponent | Animation catalog and runtime state for an entity. Combines clips imported from a model with externally added clips, exposes a state machine for named transitions, and is queried each frame by the animation system to advance mixer time. |
| AudioComponent | Plays an audio clip from path. Supports both global stereo (positional: false) and 3D positional audio with the configured distance model. Runtime fields (object, audio, isPlaying, isPaused) are recreated when the project loads and are never persisted to saved snapshots. |
| BoneAttachmentComponent | Fixes an entity to a bone of its PARENT's model — a sword in a hand, a hat on a head, a backpack on the chest — so it moves with every animation. |
| CameraComponent | Camera entity state. Supports perspective and orthographic projections, a 3d or ar runtime type, and an isDefault flag for the camera that the preview/editor renders through. Field-of-view, near/far, ortho frustum, and zoom are persisted; the live THREE.Camera is recreated when the project loads. |
| EntityType | Tags an entity with the kind it was created from (cube, sphere, model, directionalLight, etc.). Factories use this to drive kind-specific behavior; the editor inspector uses it to select component editors. |
| Environment | Scene environment settings: skybox (gradient/color/image), fog (linear/exponential), gravity vector for the physics world, and optional image-based lighting / tone mapping (values.lighting). Singleton-style — attached to one environment entity per scene. |
| FaceHeadComponent | The head in a face-tracking project. There is one, and it stands in for the person: in the editor it's a head you can see and place things on, and at runtime it follows the face the camera finds. |
| FaceAttachmentComponent | Fixes an entity to a place on its parent FaceHeadComponent: glasses to the bridge of the nose, a hat to the top of the head. |
| FaceMeshComponent | A surface that follows the face and wears a picture: face paint, a mask, make-up, a glow. It sits on the skin and moves with expression, so a painted cheek stays on the cheek through a smile. |
| GrassComponent | Stylised grass on the terrain on the same entity: thousands of blades drawn as instances, swaying in the wind, thinning out with distance and gone past viewDistance. Blades are made around the camera as it moves and dropped behind it, in square chunks, so a huge terrain costs what's near. |
| ScatterComponent | Trees, rocks and bushes scattered over the terrain on the same entity: drawn as instances in square chunks (each culled on its own), as flat pictures of themselves (impostors) past each item's impostor distance, and not at all past its cull distance. The same settings always place the same instances, so nothing about them is saved but the settings. |
| IKComponent | Inverse kinematics for a humanoid model: after the animation plays, each chain bends an arm or leg so its hand/foot reaches a target entity — the second hand on a rifle's grip, a hand on a door handle, a foot on a step. The elbow/knee keeps the animation's bend unless a pole entity says otherwise. Bones are found by humanoid name, so any rig the editor recognises works (Mixamo, auto-rigs, Unreal, VRM). |
| ImageComponent | Renders a 2D image as a textured quad in the scene. Width/height are in world units. Texture loading is handled by the image system, which populates ImageComponent.texture and ImageComponent.object asynchronously. |
| ImageTarget | Image-tracking target metadata used by AR projects. Holds the source images users uploaded plus the URL of the compiled .mind target file produced by the image-target compiler. Pair with ImageTargetAnchor on child entities that should appear when the target is detected. |
| ImageTargetAnchor | Marks an entity as an anchor for an image-tracking target. The image tracking system reveals the entity when the referenced target is found and hides it when the target is lost. |
| InstanceSlotComponent | Marks an entity as an instance slot owned by an InstancedMeshComponent group entity. |
| InstancedMeshComponent | Holds authored instanced-mesh data for an entity that renders as a THREE.InstancedMesh. Supports primitive geometry kinds (cube, sphere, plane, capsule, cylinder). |
| LODComponent | Levels of detail: simpler copies of a model drawn when it's small on screen, and an optional size or distance past which it isn't drawn at all. |
| LightComponent | Light source attached to an entity. type selects the underlying three.js light class (directional, point, spot, ambient, hemisphere, rect-area). values carries authoring state including color, intensity, and type-specific fields (distance, decay, angle, penumbra, width, height). |
| MaterialComponent | Material catalog for an entity. Tracks the live three.js materials (materials, material) plus serialized authoring state (values[]) mirrored from the inspector. Supports standard, basic, phong, and physical PBR types with optional texture map slots. |
| MeshComponent | Holds the live three.js Object3D for an entity that renders as a primitive mesh (cube, sphere, plane, capsule, cylinder). For loaded GLTF/GLB models see ModelComponent; for the editable geometry parameters see MeshGeometryComponent. |
| MeshGeometryComponent | Editable geometry parameters for primitive meshes (cube, sphere, plane, capsule, cylinder) and for model entities, whose only parameter is their pivot (see ModelMeshParameters). Holds the authoring values plus shadow casting/receiving flags. The mesh-geometry system rebuilds the underlying BufferGeometry when parameters change. |
| ModelComponent | References a GLTF/GLB asset loaded from path. The model loading system resolves the asset asynchronously and populates ModelComponent.object once available; loading is deferred-tolerant so the entity exists before the model finishes loading. ModelComponent.loadState reports progress ("loading" → "loaded" or "error"). |
| Name | Human-readable name for an entity. Shown in the editor hierarchy panel and preserved across save/reload. |
| NetworkIdentityComponent | Marks an entity as shared between players. A scene object is simulated by the host (the first player in the room, then the longest connected); a spawned object belongs to the player who spawned it and leaves with them. |
| NetworkTransformComponent | Shares an entity's position and rotation. The owner moves it at once and sends updates; everyone else plays them back a little in the past, so movement is smooth however the packets arrive. |
| NetworkedPropsComponent | Named values shared with everyone: a health bar, a score. Only the entity's owner can change them, with this.network.setProp(). values holds the starting values, and a Behaviour hears changes in onNetworkProp. |
| NetworkSpawnerComponent | Gives each player an avatar: when a client connects it spawns playerPrefab as its own, placed around this entity. |
| XRMultiplayerComponent | Multiplayer in VR and mixed reality. Each player's head and hands are shared and drawn for the others, and with colocation on, players in the same room line up their headsets by touching the same two real points. Put it on the XR Rig. Without it, an XR project with multiplayer still shares heads and hands with these defaults. |
| Object3DRef | Wraps the live THREE.Object3D for an entity. Almost every entity that renders to the scene carries an Object3DRef so transform sync, selection, and parenting systems can manipulate the underlying object. |
| OccluderComponent | Marks a solid, roughly box-shaped object (a wall, a building, a rock face) as something that hides what's behind it. Each frame the engine draws every occluder's bounding box, shrunk by inset, into a small depth buffer and skips drawing objects that are completely behind them. |
| ParentId | Records the parent entity id for hierarchical scene graphs. null means the entity is at the world root. The ObjectManagementSystem reconciles scene-graph parenting from this component each frame. |
| PhysicsComponent | Marker base class for every ECS component. Subclass Component to declare a typed data container that systems can query. |
| Postprocessing | Postprocessing stack settings (depth-of-field, bloom, vignette, chromatic aberration, noise, pixelation, tone mapping, hue/saturation, sepia, SMAA, |
| PrefabInstance | Marks the ROOT entity of a prefab instance and records its link to the source .prefab asset plus the instance's per-property overrides. |
| PrefabNode | Stable identity for an entity that originated from a prefab asset. |
| ScriptComponent | Component holding the list of scripts attached to an entity. Loaded from the saved project; the runtime-side fields (scriptInstance, scriptInstances) are non-enumerable so they never leak into save data or undo history. |
| ScriptObjectComponent | Component for a script object — a single ScriptObject whose THREE.js visual is built by user code and runs in the editor AND at runtime. Unlike ScriptComponent this holds ONE script (not an entries array). The live instance ref is non-enumerable so it never leaks into save data or undo history. |
| Selectable | Toggles whether the editor selection system can pick this entity. When enabled is false, the entity is excluded from raycast hit tests. |
| SelectionTransformState | Singleton-style component (attached once to a system entity) that mirrors the editor's current transform-gizmo state into the ECS world. Persisted in snapshots so undo/redo restores the exact gizmo configuration. |
| SpriteComponent | Camera-facing 2D sprite. Unlike ImageComponent, sprites use THREE.Sprite and always render as billboards. |
| StreamingComponent | Streams an entity and everything under it: its models load when the player comes within loadDistance and are freed from memory (geometry, textures, GPU) once they're further than unloadDistance. Put it on a model, or on a group to stream a whole region (a "cell") at once. |
| TerrainComponent | Ground you can sculpt and paint: a heightmap drawn in chunks that get simpler with distance, painted in up to four colour layers, with a physics collider and an optional occluder role (hills hide what's behind them). |
| TransformComponent | Position, rotation, and scale of an entity in its parent's local space. |
| UIButtonComponent | A pressable control. |
| UIPanelComponent | A flat UI surface in the world — the backdrop menus and HUDs are built on. |
| UISliderComponent | A draggable value control. |
| UITextComponent | A block of text drawn onto a transparent canvas quad. |
| UIToggleComponent | An on/off switch. |
| VRTeleportAreaComponent | Marks an entity's surface as a valid teleport destination. |
| VideoComponent | Plays a video file as a texture on a quad. Supports green-screen keying (isGreenScreen, backgroundColor, similarity, smoothness, spill). The video element, texture, and material are runtime-only and re-created when the project loads. |
| XRAnchorComponent | Pins an entity to a real-world position. |
| XREnvironmentComponent | Marks an entity as a piece of the user's REAL room, detected at runtime. |
| XRHandPoseComponent | Listens for hand poses and reports them to the entity's Behaviours. |
| XRInteractableComponent | Makes an entity respond to XR pointers and hands. |
| XRInteractorComponent | Configures what the user sees as their hands, and hosts custom hand content. |
| XRInteractorSideComponent | Marks an entity as the left or right hand slot of an XRInteractorComponent. |
| XRRigComponent | Marks an entity as the XR rig — the player's movable origin. |
Other ​
| Class | Description |
|---|---|
| CameraRigComponent | Makes the camera it's on follow an entity. Add it to the camera entity and pick a target; there's nothing to script. Fields left null take the usual value for the mode. |
Type Aliases ​
| Type Alias | Description |
|---|---|
| AnimationComponentOptions | Initializer for AnimationComponent. |
| BoneHold | Where an attached entity goes while certain clips play: a rifle slung on the back in Idle, a sword hidden in Swim. |
| BoneAttachmentOptions | Optional initializer for BoneAttachmentComponent. |
| CameraRuntimeType | Runtime camera mode. 3d is a free camera; ar is composited over a tracked image/face feed; xr is driven by an immersive WebXR session (the headset owns the pose and projection — locomotion moves the camera's XR rig parent). |
| CameraProjection | Projection model. |
| CameraComponentOptions | Optional initializer for CameraComponent. Any field omitted falls back to the defaults documented on the component. |
| CameraRigMode | How the camera frames what it follows. |
| CameraRigLook | How the player turns the camera. auto is the usual one for the mode. |
| CameraRigOptions | Optional initializer for CameraRigComponent. |
| EnvironmentSkyboxType | Skybox rendering modes. none disables skybox rendering entirely. |
| EnvironmentGradientEffect | Gradient distribution applied when EnvironmentSkyboxState.type is "gradient". |
| EnvironmentFogType | Fog distance models. none disables fog. |
| EnvironmentSkyboxImageProjection | How an "image" skybox is projected. |
| EnvironmentToneMapping | Tone-mapping operator applied by the renderer. "none" leaves colours linear-clamped (three's NoToneMapping). |
| EnvironmentSkyboxState | Skybox configuration. Only the fields relevant to type are read at render time. |
| EnvironmentFogState | Fog configuration. Mirrors three.js Fog / FogExp2. |
| EnvironmentLightingState | Image-based lighting and renderer colour settings. Every field is optional; the defaults below apply when a field is missing. When the whole block is absent the scene's environment map and the renderer's tone mapping are left untouched. |
| EnvironmentState | Aggregated authoring state owned by Environment. |
| FaceHeadOptions | Optional initializer for FaceHeadComponent. |
| FaceAttachmentOptions | Optional initializer for FaceAttachmentComponent. |
| FaceMeshBlend | How a face mesh mixes with what's under it. |
| FaceMeshOptions | Optional initializer for FaceMeshComponent. |
| FoliageMask | Where foliage may grow: by paint layer, height and slope. |
| GrassOptions | Optional initializer for GrassComponent. |
| ScatterItem | One kind of thing to scatter: a model, how many and how they vary. |
| ScatterOptions | Optional initializer for ScatterComponent. |
| IKLimb | The limb a chain moves: its end bone, by humanoid name. |
| IKChain | One limb reaching for an entity. |
| IKOptions | Optional initializer for IKComponent. |
| ImageTargetReference | Single uploaded image used as input to the image-target compiler. |
| ImageTargetAnchorOptions | Optional initializer for ImageTargetAnchor. |
| InstanceTransform | Per-instance transform stored inside InstancedMeshComponent. All rotations are in radians. |
| InstancedMeshKind | Primitive geometry kinds and custom 3D model kind supported by instanced mesh rendering. |
| LodLevel | One extra level of detail: a simpler copy of the entity's model. |
| LODOptions | Optional initializer for LODComponent. |
| LightShadowState | Optional shadow tuning for a shadow-casting light (directional, spot, point). Only the fields present are applied; a missing field keeps three's default, and a light without a shadow block is never touched. |
| LightValueState | Authoring state for LightComponent. Common fields apply to every light kind; the optional fields are only meaningful for specific kinds. |
| MaterialTypeValue | Supported material classes. Each maps to a three.js Mesh*Material type. |
| TextureFilteringValue | Texture sampling mode. smooth uses linear filtering; sharp uses nearest filtering for pixel-art look. |
| MaterialValueState | Authoring state for a single slot in MaterialComponent.values. Mirrors the live three.js material so it can be re-applied when the project loads. |
| EditableMeshObjectKind | Editable primitive kinds the mesh-geometry system can rebuild on the fly. model is a passthrough placeholder for entities that own a loaded GLTF/GLB instead. |
| CubeMeshParameters | Box geometry parameters in world units. |
| PlaneMeshParameters | Plane geometry parameters in world units. |
| RadiusMeshParameters | Radius-only primitive parameters (sphere). |
| RadiusHeightMeshParameters | Radius + height primitive parameters (capsule, cylinder). |
| ModelMeshParameters | Parameters of a model entity. Its only one is the pivot (0.17.0): a point in the file's space, in the entity's local units, that becomes the entity's origin. The loaded model sits inside the entity moved by -pivot, so the Transform positions, rotates and scales the model about that point. Absent (or the origin) means the file's own origin. |
| MeshGeometryParametersByKind | Map from EditableMeshObjectKind to its parameter shape. |
| MeshGeometryParameters | - |
| ModelLoadState | Load progress of a ModelComponent's asset. "unloaded": streamed out of memory because the player is far away (see StreamingComponent); it loads again when they come back. |
| NetValue | A value a networked prop can hold: anything that survives JSON. |
| NetworkTransformOptions | - |
| XRAvatarStyle | - |
| XRMultiplayerOptions | - |
| OccluderOptions | Optional initializer for OccluderComponent. |
| RigidbodyType | Rigidbody body type: - dynamic: simulated by physics; affected by forces and gravity. - fixed: immovable static body. - kinematicPosition: moved by setting next position; ignores forces. - kinematicVelocity: moved by setting velocity; ignores forces. |
| RigidbodyState | Authoring state for the rigidbody half of PhysicsComponent. Saved with the project. |
| ColliderShape | Collider primitive shape. trimesh derives geometry from the entity's mesh. |
| ColliderState | Authoring state for the collider half of PhysicsComponent. Only the size fields relevant to ColliderState.shape are read at simulation time. |
| PhysicsState | Combined authoring state for PhysicsComponent. Saved with the project. |
| PostprocessingState | Aggregated post-processing effect chain authored on the scene environment. Each sub-effect has its own enabled flag plus per-effect parameters. |
| ScriptEntry | One script attached to an entity. Multiple entries may target a single entity (different classes from the same or different files). |
| ScriptObjectRuntimeState | - |
| ScriptObjectComponentInput | - |
| TransformModeValue | Active gizmo mode in the editor. |
| TransformSpaceValue | Reference frame for the active gizmo. |
| StreamingState | Where a streamed entity is: its models freed, on their way, or shown. |
| StreamingOptions | Optional initializer for StreamingComponent. |
| TerrainLayer | A paint layer: what a part of the terrain looks like. |
| TerrainOptions | Optional initializer for TerrainComponent. |
| Vec3 | Plain XYZ vector. All ECS transform fields use this shape rather than THREE.Vector3 so they save cleanly with the project. |
| TransformData | Optional initial values passed to TransformComponent. Missing axes default to 0 for position/rotation and 1 for scale. |
| UiIconPosition | Beside the label, or above it (top, for tiles). |
| UIButtonOptions | Optional initializer for UIButtonComponent. |
| UiFollowMode | How a panel orients itself while the experience runs. |
| UiRendererMode | What draws a widget tree: uikit (instanced, a few draw calls a menu), canvas (one texture per widget, every style feature), or auto. |
| UIPanelOptions | Optional initializer for UIPanelComponent. |
| UiSliderVariant | - |
| UISliderOptions | Optional initializer for UISliderComponent. |
| UiTextAlign | - |
| UiTextVAlign | - |
| UITextOptions | Optional initializer for UITextComponent. |
| UiToggleVariant | - |
| UIToggleOptions | Optional initializer for UIToggleComponent. |
| VrTeleportShape | Footprint of a teleport destination. |
| VRTeleportAreaOptions | Optional initializer for VRTeleportAreaComponent. |
| XRAnchorOptions | Optional initializer for XRAnchorComponent. |
| XrEnvironmentKind | Which WebXR module reported this piece of the room. |
| XrEnvironmentOrientation | How a detected plane sits in the world, when the runtime says. |
| XrHandPoseEntry | One pose an entity listens for. |
| XRHandPoseOptions | - |
| XrGrabReach | How close the user must be to grab. |
| XrDistanceGrabBehavior | What a distance grab does to the object. |
| XrGrabGesture | Which gesture grabs the object. |
| XrAttachPoint | A hand-hold authored on the object. |
| XrGrabHands | How many hands may hold the object at once, and what a second grab does. |
| XrTwoHandRotation | How the second hand affects orientation. See solveTwoHandTransform. |
| XRInteractableOptions | Optional initializer for XRInteractableComponent. |
| XrInteractorType | - |
| XrHandPreset | Look applied to tracked-hand meshes. |
| XrInteractorSide | Which hand a child interactor entity follows. |
| XRInteractorOptions | Optional initializer for XRInteractorComponent. |
| XrTrackingOrigin | Where the headset's origin sits in the scene. |
| XrLocomotionMode | How the player moves through the scene in an immersive session. |
| XrEnvironmentPhysics | Which real-world geometry becomes physics colliders in a passthrough session. |
| XrView | What the player sees in a mixed reality session: their room through passthrough, or a fully virtual world drawn over it (VR). Switched live with world.setXrView, with no new session and no tap. |
| XRRigOptions | Optional initializer for XRRigComponent. |
Variables ​
| Variable | Description |
|---|---|
| DEFAULT_ENVIRONMENT_LIGHTING | Defaults for every EnvironmentLightingState field. |
| DEFAULT_ENVIRONMENT_STATE | - |
| DEFAULT_SCATTER_ITEM | - |
| DEFAULT_INSTANCE_TRANSFORM | Default identity instance transform. |
| DEFAULT_INSTANCED_MESH_PARAMETERS | Default geometry parameters per instanced mesh kind. For "model" kind, cube params are stored as a placeholder (unused). |
| DEFAULT_MESH_GEOMETRY_PARAMETERS | - |
| MODEL_NO_PATH_MESSAGE | Message used when a model entity has no asset path to load. |
| DEFAULT_RIGIDBODY_STATE | - |
| DEFAULT_COLLIDER_STATE | - |
| DEFAULT_PHYSICS_STATE | - |
| DEFAULT_POSTPROCESSING_STATE | - |
| DEFAULT_TERRAIN_LAYERS | The default layers: grass, dirt, rock, snow. |
| DEFAULT_TERRAIN_PAINT_RULES | Rock on steep slopes, snow up high: the default automatic paint. |
| DEFAULT_POSE_CURLS | - |
| DEFAULT_POSE_DIRECTIONS | - |
Functions ​
| Function | Description |
|---|---|
| normalizeBoneHold | A hold with every field filled in. |
| normalizeEnvironmentLighting | Normalize a lighting block to a complete EnvironmentLightingState. Returns undefined when value is not an object, so a scene without the block stays without it. |
| normalizeScatterItem | - |
| normalizeIKChain | A chain with every field filled in. |
| setLodActiveLevel | - |
| chooseLodLevel | The level to draw for an object covering screenSize of the screen height, given the level drawn now: -1 for culled. Pure, so it's tested on its own. |
| defaultMaterialValue | - |
| setModelLoadState | Write a model's load state as NON-ENUMERABLE own properties, so it never enters snapshots, undo history or saved projects. Always via defineProperty (the pattern setPhysicsLiveRef uses): plain assignment on a history-restored clone would create an ENUMERABLE property instead. |
| normalizePhysicsState | - |
| setPhysicsLiveRef | - |
| setStreamingState | Write the runtime state non-enumerably, so it never reaches a save. |
| unloadDistanceOf | The distance a streamed entity is freed beyond. |
| createHandPoseEntry | A pose entry with every field populated, for the editor and AI tools. |
| handPoseDefinitionFor | Resolve an entry to the definition the matcher consumes. |
| createAttachPoint | An attach point with every field populated, for the editor and AI tools. |

