Import
MD2CharacterComplex is an addon, and must be imported explicitly, see Installation#Addons.
import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js';
Properties
.angularSpeed : number
The character's angular speed.
Default is 2.5.
.animationFPS : number
The FPS
Default is 6.
.backAcceleration : number
The character's back acceleration.
Default is 600.
.controls : Object
The movement controls.
Default is null.
.currentSkin : Texture
The current skin.
Default is undefined.
.frontAcceleration : number
The character's front acceleration.
Default is 600.
.frontDeceleration : number
The character's front deceleration.
Default is 600.
.maxReverseSpeed : number
The character's maximum reverse speed.
Default is - 275.
.maxSpeed : number
The character's maximum speed.
Default is 275.
.meshWeapon : Mesh
The weapon mesh.
Default is null.
.scale : number
The mesh scale.
Default is 1.
.skinsWeapon : Array.<Texture>
The weapon skins.
.transitionFrames : number
The transition frames.
Default is 15.
Methods
.enableShadows( enable : boolean )
Toggles shadow casting and receiving on the character's meshes.
| enable |
Whether to enable shadows or not. |
.loadParts( config : Object )
Loads the character model for the given config.
| config |
The config which defines the model and textures paths. |
.setAnimation( animationName : string )
Sets the defined animation clip as the active animation.
| animationName |
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. |
.setVisible( enable : boolean )
Toggles visibility on the character's meshes.
| enable |
Whether the character is visible or not. |
.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. |
.shareParts( original : MD2CharacterComplex )
Shares certain resources from a different character model.
| original |
The original MD2 character. |
.updateAnimations( delta : number )
Updates the animations of the mesh. Must be called inside the animation loop.
| delta |
The delta time in seconds. |
.updateBehaviors()
Updates the animation state based on the control inputs.
.updateMovementModel( delta : number )
Transforms the character model based on the control input.
| delta |
The delta time in seconds. |