Import
MD2Character is an addon, and must be imported explicitly, see Installation#Addons.
import { MD2Character } from 'three/addons/misc/MD2Character.js';
Properties
.activeAnimationClipName : string
The name of the active animation clip.
Default is null.
.animationFPS : number
The FPS
Default is 6.
.meshWeapon : Mesh
The weapon mesh.
Default is null.
.mixer : AnimationMixer
The animation mixer.
Default is null.
.scale : number
The mesh scale.
Default is 1.
.skinsWeapon : Array.<Texture>
The weapon skins.
Methods
.loadParts( config : Object )
Loads the character model for the given config.
| config |
The config which defines the model and textures paths. |
.onLoadComplete()
The onLoad callback function.
.setAnimation( clipName : string )
Sets the defined animation clip as the active animation.
| clipName |
The name of the animation clip. |
.setPlaybackRate( rate : number )
Sets the animation playback rate.
| rate |
The playback rate to set. |
.setSkin( index : number )
Sets the skin defined by the given skin index. This will result in a different texture for the body mesh.
| index |
The skin index. |
.setWeapon( index : number )
Sets the weapon defined by the given weapon index. This will result in a different weapon hold by the character.
| index |
The weapon index. |
.setWireframe( wireframeEnabled : boolean )
Sets the wireframe material flag.
| wireframeEnabled |
Whether to enable wireframe rendering or not. |
.syncWeaponAnimation()
Synchronizes the weapon with the body animation.
.update( delta : number )
Updates the animations of the mesh. Must be called inside the animation loop.
| delta |
The delta time in seconds. |