Capítulo 572 de 859
This class represents a management component for animated MD2 character assets.
import { MD2Character } from 'three/addons/misc/MD2Character.js';
Constructor
| Signature |
|---|
new MD2Character() |
Properties
| Property | Description |
|---|---|
.activeAnimationClipName : string | The name of the active animation clip. |
.animationFPS : number | The FPS |
.meshBody : Mesh | The body mesh. |
.meshWeapon : Mesh | The weapon mesh. |
.mixer : AnimationMixer | The animation mixer. |
.root : Object3D | The root 3D object |
.scale : number | The mesh scale. |
.skinsBody : Array.<Texture> | The body skins. |
.skinsWeapon : Array.<Texture> | The weapon skins. |
.weapons : Array.<Mesh> | The weapon meshes. |
Methods
| Method | Description |
|---|---|
.loadParts( config : Object ) | Loads the character model for the given config. |
.onLoadComplete() | The onLoad callback function. |
.setAnimation( clipName : string ) | Sets the defined animation clip as the active animation. |
.setPlaybackRate( rate : number ) | Sets the animation playback rate. |
.setSkin( index : number ) | Sets the skin defined by the given skin index. This will result in a different texture for the body mesh. |
.setWeapon( index : number ) | Sets the weapon defined by the given weapon index. This will result in a different weapon hold by the character. |
.setWireframe( wireframeEnabled : boolean ) | Sets the wireframe material flag. |
.syncWeaponAnimation() | Synchronizes the weapon with the body animation. |
.update( delta : number ) | Updates the animations of the mesh. Must be called inside the animation loop. |