Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / ModelComponent

Class: ModelComponent ​

Defined in: components/Model.ts:49

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").

Extends ​

Constructors ​

Constructor ​

ts
new ModelComponent(path): ModelComponent;

Defined in: components/Model.ts:64

Parameters ​

ParameterType
pathstring

Returns ​

ModelComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
pathstringSource URL or localasset:// path of the GLTF/GLB asset.components/Model.ts:51
objectObject3D<Object3DEventMap> | nullLoaded model object, populated asynchronously by the model loader. null until loaded.components/Model.ts:53
loadStateModelLoadState"loading" while the asset is being fetched and parsed, "loaded" once it is attached to the entity, "error" when it failed (see loadError). A model with an empty path reports "error". Runtime-only: never saved.components/Model.ts:60
loadError?stringWhy the load failed, when loadState is "error". Runtime-only.components/Model.ts:62