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 

1.2.0+

Equivalent to getMorphTargetWeights.

Note: Prefer to use getMorphTargetWeights for performance.

.morphTargetWeights 

1.2.0+

Set the morph target weights to transform this mesh component.

.morphTargets: null | MorphTargets 

1.2.0+

Morph targets for this mesh component.

.morphTargets 

1.2.0+

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 

1.2.0+

Get the weight of a single morph target.

Returns: The weight.

ParamTypeDescription
targetnumberIndex of the morph target.

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

.getMorphTargetWeights() ⇒ Float32Array

1.2.0+

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 

1.2.0+

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 

1.2.0+

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.