MeshComponent

Native mesh component.

Provides access to a native mesh component instance.

.TypeName: string 

.material: null | Material 

Material used to render the mesh.

.material 

Set material to render the mesh with.

.mesh: null | Mesh 

Mesh rendered by this component.

.mesh 

Set mesh to rendered with this component.

.morphTargetWeights: Float32Array 

0.8.5+

Equivalent to getMorphTargetWeights.

Note: Prefer to use getMorphTargetWeights for performance.

.morphTargetWeights 

0.8.5+

Set the morph target weights to transform this mesh component.

.morphTargets: null | MorphTargets 

0.8.5+

Morph targets for this mesh component.

.morphTargets 

0.8.5+

Set morph targets to transform this mesh component.

.skin: null | Skin 

Skin for this mesh component.

.skin 

Set skin to transform this mesh component.

.getMorphTargetWeight(target: number) ⇒ number 

0.8.5+

Get the weight of a single morph target.

Returns: The weight.

ParamTypeDescription
targetnumberIndex of the morph target.

.getMorphTargetWeights<T>(out: T) ⇒ T 

.getMorphTargetWeights() ⇒ Float32Array

0.8.5+

Get morph target weights for this mesh component.

Returns: The out parameter.

ParamTypeDescription
outTDestination array, expected to have at least as many elements as count.
Template ParamType Definition
Textends NumberArray

.setMorphTargetWeight(target: number, weight: number) ⇒ void 

0.8.5+

Set the weight of a single morph target.

ParamTypeDescription
targetnumberIndex of the morph target.
weightnumberThe new weight. ## Usage js const mesh = object.getComponent('mesh'); const mouthTarget = mesh.morphTargets.getTargetIndex('mouth'); mesh.setMorphTargetWeight(mouthTarget, 0.5);

.setMorphTargetWeights(weights: Readonly<NumberArray>) ⇒ void 

0.8.5+

Set morph target weights for this mesh component.

ParamTypeDescription
weightsReadonly<NumberArray>Array of new weights, expected to have at least as many elements as count.