MeshComponent
Native mesh component.
Provides access to a native mesh component instance.
Static Members
Properties
Methods
- .getMorphTargetWeight(target) ⇒ number
- .getMorphTargetWeights<T>(out) ⇒ T
- .setMorphTargetWeight(target, weight) ⇒ void
- .setMorphTargetWeights(weights) ⇒ void
Static Members
.TypeName: string
Properties
.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.
Methods
.getMorphTargetWeight(target: number) ⇒ number
1.2.0+
Get the weight of a single morph target.
Returns: The weight.
| Param | Type | Description |
|---|---|---|
target | number | Index 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.
| Param | Type | Description |
|---|---|---|
out | T | Destination array, expected to have at least as many elements as count. |
| Template Param | Type Definition |
|---|---|
T | extends NumberArray |
.setMorphTargetWeight(target: number, weight: number) ⇒ void
1.2.0+
Set the weight of a single morph target.
| Param | Type | Description |
|---|---|---|
target | number | Index of the morph target. |
weight | number | The 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.
| Param | Type | Description |
|---|---|---|
weights | Readonly<NumberArray> | Array of new weights, expected to have at least as many elements as count. |