Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index

index ​

Classes ​

Face tracking ​

ClassDescription
FaceGestureDetectorTurns frames of tracking into state and events. One per face.

Other ​

ClassDescription
AnimationStateMachine-
AnimationStateManager-
World-
AssetLoadErrorWhat loadAssets rejects with. Every file that could load has loaded; failures says which didn't and why. Calling again retries only those.
AudioMixer-
SlotChooserDecides whether a slot sounds and which take: chance, cooldown, and never the same take twice running when there's another. No audio here, so it's testable.
CameraDirectorTakes the camera for cutscenes and gives it back. Reached with this.cameras from a Behaviour, or world.getCameraDirector().
InputActions-
TouchControls-
QualitySystemApplies graphics settings to the renderer: pixel ratio, shadows and post effects, from the player's preset or the device's recommendation, and keeps the frame rate up with dynamic resolution. Reads and writes world.settings.graphics.
OcclusionBufferA small CPU depth buffer for occlusion culling.
GameSettings-
AnimationSystem-
CameraRigSystemMoves cameras, last of all before the render: CameraRigComponent and the cutscenes run through CameraDirector.
CameraSyncSystem-
InputSystem-
InstancedMeshSystemMaintains the runtime geometry for entities with an InstancedMeshComponent.
LightSyncSystem-
MaterialSyncSystem-
MeshGeometrySystem-
ObjectManagementSystem-
ObjectVisibilitySystem-
PhysicsSyncSystem-
ScriptBehaviourSystem-
ScriptLateUpdateSystemRuns onLateUpdate on every Behaviour that has one, once everything else has moved for this frame: physics, scripts, animation, IK, and the transforms written to three.js. So a camera script reads where things will really be drawn, bones included, and can't trail by a frame depending on which script happened to run first.
TransformSyncSystem-
UIInteractionSystem-
UIPanelSystem-
VRTeleportAreaSystem-
XRAnchorSystem-
XRControllerVisualSystem-
XREnvironmentSystem-
XRHandPoseSystem-
XRHitTestSystem-
XRHoverVisualSystem-
XRInputSystem-
XRInteractionSystem-
XRLocomotionSystem-
XRSessionSystemOwns the immersive-session lifecycle and fans XR events out to Behaviours.
XRTeleportVisualSystem-
Heightfield-
UikitUiRenderer-
HandPoseTrackerTurns a stream of per-frame confidences into clean start/end events.
TeleportAimGateDecides when a teleport may actually commit.
ThrowVelocityTrackerRolling buffer of hand positions used to recover throw velocity.

Scripting ​

ClassDescription
ScriptObjectBase class for script objects — entities whose THREE.js visual is built entirely by user code (procedural geometry, shaders, particle systems, anything the editor can't author natively).

Systems ​

ClassDescription
StreamingSystemLoads and frees regions of a big world as the player moves: models under a StreamingComponent load when the player comes within its load distance and are freed once they're past its unload distance. Every model load in a world with streamed content goes through here, so models load nearest first.
AudioSystemReconciles AudioComponent state with the underlying THREE.js audio objects each frame.
BoneHoldSystemApplies each BoneAttachmentComponent's holds for the clip its character is playing: which bone it rides, where, and whether it shows. Runs after the animation and before IK, so a hand can reach for something that just moved to a new hold.
EnvironmentSyncSystemApplies the scene's Environment component to the three.js scene: skybox, fog, and (when values.lighting is present) image-based lighting, tone mapping and exposure.
FaceMeshSystemDraws every FaceMeshComponent, the same way in the editor and at runtime: the only difference is the surface. An editor gives it the canonical face and a runtime the live one, so a texture lands in the same place on both.
IKSystemRuns each IKComponent's chains after the animation: hands and feet reach their target entities. Bones the animation doesn't drive would keep last frame's IK pose and drift, so every bone IK touched is put back to its pre-IK rotation first unless the animation already overwrote it. A chain with clips fades with the clip that's playing.
LODSystemDraws a simpler level of a model when it's small on screen, and nothing when it's past its cull size or distance (LODComponent).
OcclusionCullingSystemSkips drawing objects hidden behind OccluderComponents.
PostprocessingSyncSystemBuilds the post-processing chain from the scene's Postprocessing component and hands it to RenderSystem through scene.userData:
RenderSystemDraws the frame: through the post-processing chain in scene.userData.ecsPostprocessingComposer while scene.userData.ecsPostprocessingComposerActive is true, otherwise with renderer.render(scene, camera). Runs last in the default system list.
ScriptObjectSystemBuilds, ticks, and disposes ScriptObject scripts. Unlike ScriptBehaviourSystem, this runs in the editor AND at runtime — there is NO isEditorMode gating anywhere here. A script's build() output is attached under the entity's Object3DRef.object (so it inherits transform, selection and visibility). runtimeState is written on transitions only (never every frame).
VideoSystemReconciles VideoComponent state with the underlying HTML video element and THREE.js mesh/material each frame.
FoliageSystemGrass, trees and rocks on terrains (GrassComponent, ScatterComponent). Both are built in chunks around the camera, nearest first and a few a frame, and dropped once far behind, so a huge terrain costs what's near.
TerrainSystemBuilds and draws terrains (TerrainComponent): makes the heightfield (from its file or its noise), splits it into chunks drawn simpler with distance, keeps a physics heightfield in step, and gives occlusion culling boxes for the solid ground under hills.

Interfaces ​

Face tracking ​

InterfaceDescription
FaceThe face, as a script reads it: this.face in a face-tracking project. Everything FaceTracker has, and gestures.
FaceSurfaceThe face as something to paint on. A face-tracking runtime gives the one the tracker keeps moving, and an editor gives the canonical face, so both draw the same way with the same UVs.
FaceTrackerWhat a face-tracking runtime gives the world. The project's template provides one and sets it with World.setFaceTracker; there is none in the editor or in other kinds of project, so everything reading it has to cope with null.

Hand tracking ​

InterfaceDescription
HandSourceWhat a project gives the world to read hands. The project's template provides one and sets it with World.setHandTracker, and only in a project that has hand tracking on.
HandOne hand in view.
HandsHands, as a script reads them: this.hands in a project with hand tracking on, and null anywhere else.

Other ​

InterfaceDescription
StateMachine-
EcsSystem-
SoundTakeOne recording of a slot. file is an asset path; volume multiplies the slot's.
SoundSlotA named sound the game asks for ("hit", "footstep"), played as a random take.
SoundBankAssetThe contents of a .soundbank.json asset.
HandTrackerRuntimeWhat World.setHandTracker takes: hands, and what the world needs to run them.
InputSourceReaderWhat the action layer reads each frame. InputSystem supplies the real one.
ColocationHandleColocation in mixed reality: this.network.colocation, null when the scene doesn't use it.
NetworkHandleA Behaviour's view of the shared world: this.network, null in a single-player run.
PostprocessingPipelineA built post-processing chain. RenderSystem calls render() in place of renderer.render() while it is active.
PostprocessingBuildContextEverything a backend needs to build a post-processing chain.
ChromaKeyOptionsGreen-screen settings, in the same units as VideoComponent.options.
RenderBackendEverything renderer-specific the engine does, behind one small interface so a World can run on WebGL or WebGPU.

Type Aliases ​

Face tracking ​

Type AliasDescription
FaceGestureEventOne gesture, as a script hears it.
FaceGestureThresholdsHow easily gestures fire. Expression values are how far from this person's resting face, 0 to 1, so they mean the same on anyone.
FaceGestureNameGestures a script can hear.
FaceCameraFrameWhat the camera shows. The AR canvas is transparent over the video, so nothing drawn on it can darken the picture under it: a blend that has to read the camera reads this instead.

Hand tracking ​

Type AliasDescription
HandGestureNameHand gestures a script can hear.

Other ​

Type AliasDescription
AnimationStateCallbacks-
PauseOptionsWhat world.pause() leaves alone. Both default to "pause".
ModelBoneInfoA bone of a loaded model, for bone pickers and attachment.
AssetSourceA path, or a script's AssetInput field.
AssetLoadProgress-
LoadAssetsOptions-
AssetLoadFailure-
AssetReleaseResult-
AudioUserLevelsThe player's own levels, from settings: they multiply what the game sets.
AudioBusThe mixer's groups. Music dips while a voice plays. ui is for menus: a pause never holds it, so a menu keeps its clicks.
CameraMarkA place in a shot: an entity, by id, name or inspector field, or a position.
CameraEase-
CameraShotOne camera move in a cutscene.
CameraPlayOptions-
CameraPoseWhere a camera is this frame.
FaceAttachPointIdNames of the places on a head.
FaceAttachPointOne place on the head.
PictureSideWhich side of the picture.
GestureThresholdOne measured gesture's trigger: on above on, off again below off.
FaceGestureValuesMeasured values, 0 to 1 from this person's resting face.
FaceGestureStateWhat's true of the face right now.
HeadAnglesThe head's angles in degrees. yaw + is the nose to the picture's right, pitch + is looking down, roll + leans to the picture's left.
FaceGestureSampleOne frame of tracking.
FaceSurfaceCutsWhich parts of the face a mesh leaves open.
FaceHeadFitHow a person's head compares with the average one.
FacePoseWhere the head is on one frame of tracking.
ModelLoadGateSomething that decides when a model starts loading: the streaming system, which holds back models out of range and starts the rest nearest first. start begins the load.
UnsubscribeTakes a listener back off.
ScreenPositionA place on screen, in CSS pixels from the top left of the page, the same as a pointer event's clientX and clientY.
HandPoseNameNamed poses.
HandPointNameA named place on a hand.
HandSideWhich hand. The person's own: left is their left hand, on any camera.
HandTrackingStatusWhether hands can be read yet.
HandDetectionOne hand on one frame of detection, from the runtime.
HandWorldOptionsHow hands sit in the world.
HandGestureEventOne gesture, as a script hears it.
HandAttachOptionsWhich hand to attach to, and how.
ComponentValueMaps-
EcsWorldComponentSnapshot-
EcsWorldStateSnapshotLike-
HydrateWorldFromSnapshotResult-
HydrateOptionsOptional behavior tweaks for hydrateWorldFromSnapshotDetailed. Defaults preserve the historical full-world-load behavior; prefab/subtree instantiation passes stricter options.
InputTuningHow sticks and sensitivity feel. The settings store writes the player's part.
NavigationDirectionA menu step from the navigate action, with hold-to-repeat.
InputDeviceWhere an input came from last. Prompts and touch controls follow it.
ParsedBinding-
InputActionDefinitionA button press (kind: "button") or a direction (kind: "axis").
InputActionMap-
GamepadFamilyThe kind of pad, read from its id. Decides button names and glyphs.
GamepadButtonName-
GamepadSnapshotOne pad's state for a frame, read from navigator.getGamepads().
TouchButtonConfigOne on-screen button. id is what bindings name: touch:<id>.
TouchControlsConfig-
TouchVisibility-
ColocationStatus-
NetSpawnOptionsOptions for NetworkHandle.spawn.
ApplyPrefabToSnapshotResult-
InstantiateSubtreeResult-
NodeKeyMaps-
NestedRegion-
NodeMaps-
SerializeEntitySubtreeResult-
SubtreeSnapshotSnapshot-space entity-id walking/remapping.
ExternalRefWarning-
RemapSnapshotOptions-
SpawnPrefabSource-
SpawnPrefabOptions-
PrefabAssetEnvelope of a .prefab asset file (and, later, .scene assets — same shape with type: "scene"). snapshot is the same columnar world-snapshot format hydrateWorldFromSnapshotDetailed consumes, with entity ids renumbered 1..N and every entity carrying a PrefabNode identity.
QualitySystemOptions-
GpuTier-
DeviceProfile-
QualityRecommendation-
QualityPresetName-
QualityPreset-
QualityLimitsWhat the engine actually applies this frame.
EcsRendererA renderer a World can run on: three's classic WebGLRenderer, or WebGPURenderer from three/webgpu (which falls back to WebGL 2 on its own when the browser has no WebGPU).
RendererKindWhich renderer family a world is drawing with.
CullReasonFlag-
FoliageMaterialOptionsWhat a foliage (grass) material needs: blades whose geometry carries aHeight (0 at the root, 1 at the tip) and a colour per vertex, drawn as instances with a per-instance aPhase so neighbours sway out of step.
FoliageWindLive wind values for a foliage material.
ScriptErrorPhaseWhere in a script's life an error happened.
ScriptErrorSourceWhich kind of script failed.
ScriptErrorEventEmitted by world.onScriptError(...) the first time a distinct script error occurs. "Distinct" is the combination of script URL, class name, phase and message: ten enemies running the same broken script report once.
ScriptErrorListenerListener registered with world.onScriptError(...).
ScriptErrorReportWhat a system knows when it reports a script error.
ShadowSetting-
PostFxSetting-
GraphicsSettings-
AudioSettings-
TouchStickMode-
ControlsSettings-
GameplaySettings-
GameSettingsData-
GameSettingsSection-
GameSettingsListener-
GameSettingsPatchDeep partial for update.
StreamingFocusWhat the player's position is read from.
StreamingSettingsWorld-wide streaming settings. Scripts change them through world.streaming.
StreamingStats-
PlaySlotOptionsOptions for AudioSystem.playSlot.
FaceMeshSystemOptionsWhat a FaceMeshSystem draws on.
MouseButton-
InputSystemOptionsOptions for InputSystem. Everything is optional; new InputSystem() still works.
InputPromptHow an action reads on screen for the device in use.
EcsComponentFactoryKind-
ComponentFactory-
OccluderBoxExtra occluders a system provides (terrain chunks): a local box and its world matrix.
OccluderSource-
OcclusionStats-
ScriptBehaviourSystemOptionsOptions for ScriptBehaviourSystem.
SelectionContextOptional context that enables raycast-based onSelect / onDeselect dispatch. When provided, pointer/touch taps on the canvas fire a raycast against the scene. If the hit object (or any ancestor) carries userData.entityId, every Behaviour instance for that entity receives onSelect(); the previously selected entity's instances receive onDeselect().
UiCanvasLikeStructural canvas type so tests can inject a stub with no DOM.
XrHandPoseEventDetail-
XrHitResultWhere a ray met the real world.
KeyboardKey-
ModuleLoaderResolves a script URL to its ES module namespace.
Placement-
TerrainNoise-
TerrainPaintRuleAn automatic paint rule: a layer wins where height and slope fall in range.
ImpostorPictures of a model from all round, for drawing it as a flat card far away. One small texture per direction (no atlas, so no renderer-specific shader picks the frame: a chunk of cards just uses the picture nearest its view). width and height are the card's size in the model's units; bottom is where its base sits.
UiColorStopThe style model for spatial UI.
UiPaint-
UiShadow-
UiPatternA texture laid over a surface's fill, inside its shape: the scanlines of a terminal, the grid of a holo-table, a paper grain. Spacing and width are metres; angle turns stripes, in degrees.
UiMotionHow a pressable widget moves. lift is metres toward the viewer while pointed at, scale the size while pointed at, pressScale the size while held, and speed how quickly it gets there (higher is snappier).
UiTextStyle-
UiStateStyleWhat a state changes. A state can't hold states of its own.
UiStyle-
UiTokens-
UiPanelVariant-
UiTextVariant-
UiButtonVariant-
UiThemeControlColours for a toggle or slider: off/empty, on/filled, and the knob.
UiTheme-
UiThemeFileA theme file: any part of a theme, laid over the one it extends.
UikitModuleDraws spatial-UI widget trees with @pmndrs/uikit: one uikit root per tree, so a whole menu is a few instanced draw calls instead of one canvas texture and quad per widget.
UiRendererStatus-
SharedModelVersionResolverSays which version of the file at url is current, e.g. its modification time. A different answer than the loaded copy had means the file changed, so the next placement loads it again. undefined when it can't tell.
SharedModelStats-
ModelPivot-
RaycastQueryWhat intersectScene and World.raycast accept.
XrHandJointNameThe 25 joints of the WebXR hand skeleton.
XrFinger-
XrHandJointsJoint positions, in world space.
XrFingerCurlHow curled one finger is.
XrPalmPoseAn orthonormal frame attached to the palm.
XrHandShapeEverything a pose is matched against, derived once per hand per frame.
XrFingerTargetTarget curl for one finger, with the slack allowed around it.
XrHandPoseAxisWhich way something on the hand must point for the pose to count.
XrHandPoseDirection-
XrHandPoseOrientation-
XrHandPoseDefinitionA matchable hand pose.
XrHandPoseMatch-
XrHandPoseContextExtra world context needed only by head-relative orientation conditions.
XrHandPoseEvent-
HandPoseTrackerOptions-
HandMaterialOptionsMaterials for tracked-hand meshes.
VelocitySample-
XrHandednessWhich hand an input source belongs to (none for gaze / single-source devices).
XrInputKindHow an input source is physically driven.
XrInputStateOne frame of normalized input for a single source.
XrCapabilitiesWhat the ACTIVE session actually granted us.

Variables ​

Face tracking ​

VariableDescription
FACE_ATTACH_POINTSEvery place on the head.

Other ​

VariableDescription
FACE_HEAD_UNIT_CMThe canonical head's face width in centimetres: one head unit.
DEFAULT_FACE_GESTURE_THRESHOLDSThe defaults. See docs/guide/face-gestures.md for where they come from.
HYDRATABLE_ENTITY_KINDS-
DEFAULT_INPUT_TUNING-
DEFAULT_INPUT_ACTIONSActions every game gets. A script reads this.input.getAxis("move") and the player can use WASD, arrows, either stick, the D-pad or the touch stick.
GAMEPAD_BUTTONSButtons by position in the standard mapping, so a binding means the same physical button on every pad: south is A on Xbox, Cross on PlayStation and B on a Switch pad.
DEFAULT_TOUCH_CONTROLS-
NODE_KEY_SEPARATOR-
ADDED_NODE_MARKER_COMPONENTReserved override "component" marking a node ADDED by the host document inside a nested instance region (`"<nodeKey>
OVERRIDE_DIFF_EXCLUDED_COMPONENTSComponents that never participate in override diffing/merging.
OVERRIDE_ROOT_EXCLUDED_COMPONENTSComponents excluded ONLY on the instance ROOT node — these are per-instance by definition (where the instance sits in the scene and what it's called).
PREFAB_FILE_VERSION-
PREFAB_FILE_VERSION_NESTEDWritten for files containing NESTED instances (parse accepts either).
QUALITY_PRESET_NAMES-
QUALITY_PRESETS-
CullReasonWhy the engine isn't drawing an object. Several systems hide things for their own reasons (out of streaming range, too far, behind a wall), and an object shows again only when none of them still wants it hidden. None of this is the entity's own visibility (Object3DRef.visibility), which stays what the game set: scripts, physics and audio carry on as before.
LOD_COPY_KEYOn an object the LOD system mounted beside an entity's model: another level of detail, or an impostor. Physics, bounds and the editor skip these, since they're other looks of the same thing.
webglBackendThe default RenderBackend: three's WebGLRenderer, post-processing through EffectComposer, GLSL chroma key.
GAME_SETTINGS_VERSION-
DEFAULT_SCRIPT_ERROR_RETRY_DELAYSeconds a Behaviour waits after an error (load, init() or update()) before it is re-initialised. Without the wait a script that throws every frame was torn down and rebuilt every frame.
SCRIPT_OBJECT_ROOT_FLAGTags the Object3D a script's build() returned, so reloads can find/remove it.
BUNDLED_INPUT_PROFILESThe input profiles the engine ships a copy of (dist/assets/xr-input-profiles in the package): every Quest's controllers and the tracked-hand model. A game that serves that folder and passes its address as inputProfilesPath loads these from itself; any other controller still comes from the CDN. Keep in step with scripts/copy-input-profiles.mjs.
INPUT_PROFILES_CDNWhere three loads input profiles from when the game serves none.
XR_HOVER_SHELL_FLAGMarks shell meshes so they are never mistaken for scene content.
KeyboardKeys-
TERRAIN_OBJECT_KEYOn a terrain's own objects: what they are, so the editor and tools can tell.
TERRAIN_LAYERSPaint layers a terrain blends between.
DEFAULT_TERRAIN_NOISE-
IMPOSTOR_VIEWSHow many directions an impostor is pictured from.
UI_ICON_NAMESEvery built-in icon name, sorted.
UI_PANEL_VARIANTS-
UI_TEXT_VARIANTS-
UI_BUTTON_VARIANTS-
UI_THEMESEvery built-in theme, by name.
UI_THEME_NAMES-
UI_RENDERER_KEYOn a tree root's object: what draws the tree and why. For the editor.
SHARED_MODEL_RESOURCE_FLAGuserData flag set on geometries/materials that back shared (cached) model scenes. Entity disposal must skip these — other live clones and future spawns reference the same GPU resources.
SHARED_MODEL_GRACE_MSHow long a model nothing uses stays loaded, in case it's placed again.
MODEL_PIVOT_WRAPPER_FLAGuserData flag on the wrapper group that carries a model's pivot offset.
SPATIAL_ECS_FEATURESSpatial-ecs features a host (the editor) can check at run time.
RAYCAST_BVH_MIN_TRIANGLESMeshes with fewer triangles than this are tested the plain way.
XR_FINGERS-
PINCH_FINGERSFingers that can oppose the thumb. The thumb cannot pinch itself.
FALLBACK_HAND_SCALEFallback palm width when the hand is too poorly tracked to measure.
STRAIGHT_COSStraightness normalization.
CURLED_COS-
MATCH_FALLOFFConfidence falls to zero this far outside a target's tolerance band.
DEFAULT_DIRECTION_TOLERANCEDefault cone for per-finger direction constraints.
DEFAULT_ENTER_CONFIDENCE-
DEFAULT_EXIT_CONFIDENCE-
DEFAULT_MIN_HOLD_SECONDS-
DEFAULT_LOST_GRACE_SECONDS-
HAND_POSE_PRESETSBuilt-in poses, keyed by id.
HAND_POSE_PRESET_IDSPreset ids, in the order the editor lists them.
ARC_GRAVITYDownward acceleration applied to the aim curve, m/s².
ARC_SPEEDLaunch speed of the virtual projectile, m/s. Tuned for ~5-8m reach.
ARC_STEPSSamples along the curve. Enough to look smooth without wasting raycasts.
ARC_MAX_TIMESeconds of flight to simulate before giving up on finding ground.
VELOCITY_SAMPLESSamples retained. ~5 frames ≈ 55ms at 90Hz — long enough to smooth noise.
MAX_SAMPLE_AGE_SECONDSSamples older than this are ignored on release.
MAX_PLAUSIBLE_SPEEDFastest hand motion treated as real, in metres/second.
NO_XR_CAPABILITIESCapabilities for "no session running" — every feature off.

Functions ​

Face tracking ​

FunctionDescription
getFaceAttachPointThe place with this name, or undefined.
faceAttachPointPositionWhere a place is on the average head, in head units. This is where it is in the editor, and on a person until they've been measured.

Other ​

FunctionDescription
listModelBonesEvery bone of a loaded model, parents before children.
findModelBoneThe bone an attachment names in root: by node name, then by its sanitized form (a name saved from a source file), then by humanoid name (the same body part on another rig). null when none matches.
setWorldQuaternionSets a node's world rotation, keeping its position (children follow).
twoBoneIKTwo-bone IK: rotates upper and lower so end's origin (the wrist or ankle) reaches target, bending toward pole (pass the animated elbow/knee position to keep the animation's style). Unreachable targets are reached for as far as the limb allows. Returns how far the end stayed from the target (0 when reachable). forward is the way the character faces, for a limb too straight to say which way it bends.
gripQuaternionWorld rotation for a hand gripping a bar along axis (unit), for hands whose bones run +X across the knuckles, +Y along the fingers and +Z out of the palm (the editor's fixed rigs). The back of the hand faces back (projected off the axis); the fingers continue away from the elbow (forearm = elbow → wrist).
loadAssetsLoad files now and resolve when they're ready. A model, a texture, a sound, a .prefab (with every file inside it) or a .soundbank.json; anything else is fetched as bytes.
isAssetLoadedWhether a file has finished loading, by this API or by a model entity.
getLoadedAssetA loaded file, or undefined if it isn't ready: a GLTF for a model, a THREE.Texture for an image, a PrefabAsset for a prefab, an ArrayBuffer for anything else.
releaseAssetsFree loaded files: GPU memory and the bytes kept for them. A file that's wanted again just loads again.
soundBankFilesEvery recording a bank needs.
dampFactorHow much of a gap to close this frame so it shrinks at the same rate at any frame rate. smoothTime is the seconds it takes to close about 63% of a gap; 0 closes all of it.
dampEase current toward target. See dampFactor.
shortestAngleThe signed shortest turn from one angle to another, in radians.
dampAngledamp for an angle in radians, the short way around.
dampVector3damp for each axis of current, in place.
createAnimationComponent-
createAudioComponent-
createBoneAttachmentComponent-
createCameraComponent-
createCameraRigComponent-
createEntityTypeComponent-
createEnvironmentComponent-
createFaceMeshComponent-
createFaceAttachmentComponent-
createFaceHeadComponent-
createGrassComponent-
createIKComponent-
createImageComponent-
createImageTargetAnchorComponent-
createImageTargetComponent-
createInstanceSlotComponent-
createInstancedMeshComponent-
createLODComponent-
createLightComponent-
createMaterialComponent-
createMeshComponent-
createMeshGeometryComponent-
createModelComponent-
createNameComponent-
createNetworkIdentityComponent-
createNetworkTransformComponent-
createNetworkedPropsComponent-
createNetworkSpawnerComponent-
createXRMultiplayerComponent-
createObject3DRefComponent-
createOccluderComponent-
createParentIdComponent-
createPhysicsComponent-
createPostprocessingComponent-
createScatterComponent-
createScriptComponent-
createScriptObjectComponent-
createSelectableComponent-
createSelectionTransformStateComponent-
createSpriteComponent-
createStreamingComponent-
createTerrainComponent-
createTransformComponent-
createUIButtonComponent-
createUIPanelComponent-
createUISliderComponent-
createUITextComponent-
createUIToggleComponent-
createVRTeleportAreaComponent-
createVideoComponent-
createXRAnchorComponent-
createXRHandPoseComponent-
createXRInteractableComponent-
createXRInteractorComponent-
createXRInteractorSideComponent-
createXRRigComponent-
reloadModelEntityLoad a model entity's file again (it was rewritten: optimised, re-rigged, its animations edited) and swap it in. The old loaded scene is removed and its own geometry and materials disposed; the entity, its components and its children stay, and objects attached to its bones move onto the new ones. Returns false when the entity has no model to reload.
unloadModelEntityTake a model entity's loaded scene off it (streaming: the player is far away). The entity and its components stay, its state becomes "unloaded", and its clone's own skeletons go; the file's shared geometry and textures are freed separately once nothing else shows them (releaseAssets). Bring it back with reloadModelEntity. Returns false when there's nothing to take off.
registerDefaultComponentFactories-
registerDefaultFactories-
buildComponentValueMaps-
hydrateWorldFromSnapshotDetailed-
hydrateWorldFromSnapshot-
restorePostCreateComponents-
restoreComponentState-
parseBindingRead a binding string; null when it isn't one.
isAxisBindingWhether a binding gives a direction (an axis) rather than a press.
bindingDeviceThe device a binding belongs to.
keyLabelA key code as printed on the key: KeyW → W, Digit1 → 1, ShiftLeft → Shift.
bindingLabelHow a binding reads on screen: "Space", "Left Click", "A" or "✕", "WASD", "Left Stick". symbol gives PlayStation's shapes instead of their names.
cloneActionMapCopy of an action map that can be edited without touching the original.
gamepadButtonIndexA standard-mapping index from a name ("south", "a", "cross", "rt") or a number.
gamepadFamilyWhich family a pad belongs to, from Gamepad.id.
gamepadButtonLabelWhat a button is called on this kind of pad: "A", "Cross", "RT", "Options".
gamepadButtonSymbolThe shortest mark for a prompt: "✕" on PlayStation, "A" on Xbox.
gamepadFamilyNameThe display name of a pad family, for "Xbox controller connected".
applyRadialDeadZoneA radial dead zone with the outer edge rescaled, so a stick at rest reads exactly zero, a small push starts from zero instead of jumping, and the rim reaches 1 even on a worn pad.
applyTriggerDeadZoneA trigger or analog button below threshold reads as zero; above it, rescaled to 0..1.
snapshotGamepadPlain numbers from a live pad: a button's value is 1 when pressed even if its analog value lags.
stickVectorWhere a thumb dx, dy px from the stick's centre points, as -1..1 with y up, and where to draw the knob.
applyPrefabToSnapshotInstancesPatch every top-level-relative nested instance of nestedUrl inside hostSnapshot with newNestedSnapshot. Deeper nesting (B inside C inside A) is NOT touched here — it cascades through C's own file.
collectEntitySubtreeCollect the given roots plus every descendant, BFS parent-first, using the ParentId component edges. Parent-first ordering matters: serialization renumbers ids in this order and instantiation creates entities in file order, so parents always exist before their children are linked.
collectDirectPrefabDependenciesDirect (top-level-relative) prefab urls a document depends on — the edges of the nesting graph. Deeper nesting is reached transitively through each dependency's own file, never directly.
instantiateSubtreeHydrate a self-contained subtree snapshot (a prefab file's snapshot) into a LIVE world: fresh entity ids, internal references remapped, no camera promotion, transform pass scoped to the created entities.
buildNodeKeyMapsFromSnapshot-
collectSnapshotSubtreeIdsJSON-space subtree ids (root first, BFS) via ParentId edges.
findTopLevelNestedRegionsTOP-LEVEL-RELATIVE nested instance regions of a document: instance roots that are not the scope root and not themselves inside another region. Deeper nesting is reached by cascading through the intermediate prefab's own file, never directly.
findSnapshotRootEntityIdsEntity ids of entities whose ParentId is null or absent.
buildNodeMapsFromSnapshot-
indexSnapshotByEntityInvert the columnar snapshot into entityId → (componentName → value).
canonicalizeComponentValueCanonicalize a serialized component value into nodeId-space: - entity-id fields → {$node} (internal) or raw id (external) - ScriptComponent entries keep only {className, scriptUrl, enabled, data} (entityId/runtimeState/runtimeMessage are per-instance transients) - ScriptObjectComponent keeps only {scriptUrl, className, enabled, data} (runtimeState/runtimeMessage are per-instance transients) - Object3DRef keeps only {visibility} (the rest is a live object ref)
decanonicalizeComponentValueReplace every {$node} marker (at any depth) with the mapped entity id from nodeToId, or null when the node no longer exists. Exact inverse of canonicalization for the id-bearing positions.
encodeOverride-
parseOverride-
groupOverridePathsnodeId → componentName → set of overridden paths.
collectDiffPathsCollect leaf paths where two canonical values differ. Semantics: - {$node} refs compare atomically by nodeId - arrays of differing length are ONE atomic override (the array path); equal lengths recurse per index - object key present on one side only marks that key's path - type mismatches mark the current path An empty-string path means the values differ at the top level.
computeInstanceOverridesDiff a live instance subtree against its prefab base (both as serialized subtree snapshots carrying PrefabNode identity) and return the encoded override list: every path where the instance deviates from the base.
mergeComponentValueMerge a component's NEW canonical file value with an instance's canonical value, preserving the instance side at every overridden path. An empty path ("") means the whole component is overridden → instance wins.
serializeEntitySubtreeSerialize rootId + all descendants into a self-contained snapshot: entity ids renumbered 1..N in BFS parent-first order, all internal id references remapped, external references nulled + reported, root ParentId forced to null. The result is directly consumable by hydrateWorldFromSnapshotDetailed / instantiateSubtree.
remapSnapshotEntityIdsReturn a deep-cloned snapshot with every entity id (entity list, entry keys, and all id-bearing component fields) remapped through idMap. References to ids missing from the map follow externalRefPolicy and are reported in warnings (with ids in the INPUT snapshot's id space).
loadPrefabFetch + parse (and cache) a .prefab asset. All strings inside the snapshot are passed through the registered URL resolver, so asset references load correctly in published/preview builds. Use this from preloaders to warm the same cache spawnPrefab reads.
clearPrefabCacheDrop one cached prefab (or all when no url is given).
spawnPrefabInstantiate a prefab into a live world at runtime.
despawnPrefabDelete a spawned prefab instance: the root entity plus every descendant (children first). Returns the number of entities removed. dispose releases GPU resources not flagged as shared (safe with the model cache).
prefabFileVersionForFile version to write for a given snapshot: 2 iff it nests instances.
parsePrefabAssetValidate untrusted JSON into a PrefabAsset, or null when malformed.
classifyGpuRough class of a GPU from its name.
readGpuNameThe GPU's name from a WebGL context, or a WebGPU adapter's info.
detectDevice-
recommendQualityPresetThe preset a device should start on, with the reasons in plain words.
presetSettingsThe settings fields a preset sets, for a settings screen that shows them.
resolveQualityLimitsSettings + the device's recommendation → what to apply. auto takes the recommendation; a named preset its own switches; custom the player's switches, with the pixel-ratio cap of the closest preset.
effectivePixelRatioThe pixel ratio to draw at: the device's, capped by the preset, times the player's and the governor's scale. Ultra also stays inside a pixel budget.
cullMaskOfThe reasons an object is hidden for, as a bit mask (0: none).
setObjectCulledHide or show an object for one reason. An entity's own object is drawn when its visibility is on and no reason is left (ObjectVisibilitySystem); any other object (a loaded model inside its entity, a level of detail) is shown here directly.
isObjectCulled-
isLodCopyWhether this object is, or sits inside, an extra level of detail.
defaultGameSettings-
normalizeGameSettingsEvery field checked and clamped; unknown gameplay keys kept if they're plain JSON.
estimateObjectBytesEstimated GPU bytes an object's meshes hold: every attribute and index buffer, and every texture at 4 bytes a pixel with a third more for mipmaps. Shared geometry and textures are counted once per call. An estimate: the GPU can compress or pad.
inputProfilesPathForThe folder to load a controller's model from: the game's own copy when it has one and the controller reports a bundled profile, else the CDN.
passesMaskWhether a terrain point passes a mask.
placeInChunkWhere things go in one chunk (terrain space, metres): perSquareMetre tries per square metre, kept where the mask allows and at least spacing from the others. Deterministic, and in random order, so drawing the first N of them thins the chunk evenly.
grassShareShare of a chunk's blades drawn at this distance: all up close, none at the view distance.
makeBladeGeometryA blade: a tapered strip, aHeight 0 at the root and 1 at the tip, coloured base to tip.
heightfieldColliderDescRapier's heightfield: (rows + 1) x (cols + 1) heights in column-major order, rows along Z and columns along X, centred on the collider and spanning scale metres. World scale is folded in.
valueNoiseSmooth 0-1 value noise.
seededRandomA small seeded random generator (mulberry32), 0-1.
impostorViewThe direction (0..IMPOSTOR_VIEWS-1) to draw for a viewer at this angle round the model.
captureImpostorRender a model into impostor pictures with the game's own renderer. Restores the renderer's target and clear colour. Returns null when the renderer can't draw into a target (a stand-in in tests, a lost context).
chunkLevelForThe level a chunk this far away draws at: each level skips twice as many points.
buildChunkGeometryBuild one chunk's geometry at a level of detail (stride = 2^level grid steps between vertices). Positions are terrain-space; normals come from the heightfield, so chunks at different levels meet with the same shading. A skirt hangs down skirt metres around the edge to hide the cracks where a detailed chunk meets a simpler one. Colours blend the paint layers.
forgetUiThemeRead a theme file again, after it changed on disk.
uiIconSvgThe icon as a standalone SVG document, white so a tint can recolour it. strokeWidth is in the 24-unit view box: 2 is Tabler's own, 1.5 reads lighter, 2.5 bolder.
mergeUiStyleover laid on base: each field over sets replaces the base's, except text, motion and the states, which merge field by field. Neither input is changed or shared.
colorWithAlpha#rgb, #rrggbb or #rrggbbaa at an opacity, as rgba().
isUiThemeFileWhether theme names a file rather than a built-in theme.
normalizeUiThemeFileA clean copy of a theme file's JSON. Anything of the wrong shape is dropped.
themeFromFileThe theme a file describes: the built-in theme it extends (holo when it names none or one that doesn't exist) with the file laid over it.
setPrefabAssetUrlResolverOverride how prefab asset URLs (the file URL itself AND every asset URL stored inside prefab files) are resolved before fetching. Published/preview runtimes register a resolver that maps the editor's localasset://…/assets/x URLs to ./assets/x; the editor leaves it unset (identity — the localasset:// protocol is fetchable there). Same pattern as setDracoDecoderPath. Pass null to restore identity.
setDracoDecoderPathOverride where the DRACO decoder files (draco_wasm_wrapper.js, draco_decoder.wasm, draco_decoder.js) are fetched from. Embedding apps whose bundlers relocate this package's chunks — making the default import.meta.url resolution point at a location that is never populated — should call this before any model loads. The path must end with "/". Pass null to restore the default resolution.
resolveDracoDecoderPath-
createGLTFLoaderThe one GLTFLoader setup for every model and clip the engine loads.
loadSharedGltfLoad a GLTF once per URL and share the parsed result, so repeated spawns of the same model skip both the fetch and the parse. The cached scene must never be mounted directly (an Object3D has a single parent) — mount a cloneModelScene() of it. Failed loads are evicted so a retry re-fetches.
clearModelCacheForget cached models (one URL, or everything). Subsequent loads fetch and parse anew. Does not dispose GPU resources — live clones may still use them.
setSharedModelVersionResolverTell the shared models how to read a file's version. Without one, a file is loaded once until evictSharedModel forgets it.
acquireSharedModelLoad the model at url once and hand out a copy to mount. Every copy shares the load's geometry and textures and has its own materials. Give each copy back with releaseSharedModel when it's no longer used; the load is freed once no copy is left. A failed load is forgotten, so a retry fetches.
releaseSharedModelGive back a copy from acquireSharedModel. When it was the last one, the load is freed after graceMs unless it's acquired again by then. The copy's own materials are the caller's to dispose. Returns false for an object that isn't a copy (or was given back already).
getSharedModelCopiesEvery copy handed out and not given back yet.
evictSharedModelForget the model at url (or every model), so the next acquisition loads the file again. Copies in use keep theirs, freed when the last is given back; a load nobody uses is freed now.
getSharedModelStatsWhat's loaded, for debugging and tests.
readModelPivotThe pivot stored in a model's geometry parameters, or null when there is none, it isn't three finite numbers, or it's the origin.
getModelPivotWrapperThe wrapper holding model (or a stale empty one) under anchor, if any.
applyModelPivotHang model under anchor moved by -pivot, or straight under it for no pivot. Idempotent and cheap: call it when the model mounts and whenever the pivot may have changed. The model's own local transform is never touched.
installAcceleratedRaycastRoute every THREE.Mesh raycast through the engine's accelerated path. Idempotent; the World calls it. Turn it off with setAcceleratedRaycastEnabled to compare.
setAcceleratedRaycastEnabledTurn the hierarchies off (or back on) for every raycast.
isAcceleratedRaycastEnabled-
hasRaycastBvhWhether a geometry has a hierarchy now (for tests and stats).
disposeRaycastBvhDrop a geometry's hierarchy, e.g. after editing its vertices by hand.
intersectSceneIntersect roots (recursively). With firstHitOnly, meshes are visited nearest bounding sphere first and the search stops once the next sphere starts beyond the best hit, so a ray through a city tests the few buildings in front instead of all of them.
computeFingerCurlCurl for one finger, or null when the finger isn't tracked well enough.
computePalmWidthDistance across the knuckles — our unit of hand size.
estimateHandScaleCharacteristic hand size in metres.
computePinchHow close a fingertip is to the thumb tip. 1 = touching, 0 = far apart.
computeSpreadAngular separation between two fingers. 0 = parallel, 1 = splayed wide.
computePalmPosePalm frame, used for orientation conditions ("palm up", "thumb toward face").
computeHandShapeReduce tracked joints to the matchable shape.
matchHandPoseScore a live hand against a pose.
getHandPosePresetA deep copy of a preset.
cloneHandPose-
handPoseFromCurlsBuild a pose from five curl values — the shape the editor's sliders and the AI tools produce.
createHandMaterialBuild the material for a preset.
applyHandMaterialApply a preset material to every mesh under a hand model.
sampleTeleportArcSample a ballistic curve starting at origin heading along direction.
arcGroundCrossingWhere a sampled arc first crosses groundY going downward, or null.
angularVelocityFromAngular velocity from a rotation delta, as an axis-angle vector (rad/s).
readXrCapabilitiesRead granted features off a live session.

References ​

Component ​

Re-exports Component


Behaviour ​

Re-exports Behaviour


UiInteractionEvent ​

Re-exports UiInteractionEvent


CoreComponents ​

Renames and re-exports components


EntityId ​

Re-exports EntityId


EcsEntityKind ​

Re-exports EcsEntityKind


EcsEntityEditorKind ​

Re-exports EcsEntityEditorKind


SelectionListener ​

Re-exports SelectionListener


TextInput ​

Re-exports TextInput


FloatInput ​

Re-exports FloatInput


ColorInput ​

Re-exports ColorInput


Vector2Input ​

Re-exports Vector2Input


Vector3Input ​

Re-exports Vector3Input


SliderInput ​

Re-exports SliderInput


Re-exports DropdownOption


Re-exports DropdownInput


CheckboxInput ​

Re-exports CheckboxInput


ToggleInput ​

Re-exports ToggleInput


AssetInput ​

Re-exports AssetInput


EntityInput ​

Re-exports EntityInput


ComponentKind ​

Re-exports ComponentKind


ComponentInput ​

Re-exports ComponentInput


WorldEntityView ​

Re-exports WorldEntityView


ParentLookup ​

Re-exports ParentLookup


Vec3 ​

Re-exports Vec3


RaycastLayers ​

Re-exports RaycastLayers


RaycastOptions ​

Re-exports RaycastOptions


IntersectionResult ​

Re-exports IntersectionResult