Modelcomponent

ModelComponent class

Model component, used to display gltf 3D models in the game (.gltf, .glb)

See ModelComponentData for the data schema used to create a model component

Signature:

export declare class ModelComponent extends Component3D<ModelComponentData> 

Extends: Component3D<ModelComponentData>

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ModelComponent class.

Properties

Property

Modifiers

Type

Description

enableAnimation

boolean

Enable the animation system for this model. Defaults to false, works only on model that embeds animations

mixer

readonly

any

opacity

number

Set the opacity of the model. Defaults to 1

renderMode

RenderMode

Model render mode. Defaults to "default"

Methods

Method

Modifiers

Description

dispose()

protected

getAnimationData()

Get the animation data of the 3D model

init()

protected

play(name, opts)

Play an animation on the 3D model. This applies only to animated gltf models containing animations.

setAnimationAtTime(animation, val)

Set the time of an animation on the 3D model

stop(name)

Stop an animation on the 3D model

stopAll()

Stop all animations on the 3D model