Capítulo 573 de 859
This class represents a management component for animated MD2 character assets. It provides a larger API compared to MD2Character.
import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js';
Constructor
| Signature |
|---|
new MD2CharacterComplex() |
Properties
| Property | Description |
|---|---|
.angularSpeed : number | The character's angular speed. |
.animationFPS : number | The FPS |
.backAcceleration : number | The character's back acceleration. |
.controls : Object | The movement controls. |
.currentSkin : Texture | The current skin. |
.frontAcceleration : number | The character's front acceleration. |
.frontDeceleration : number | The character's front deceleration. |
.maxReverseSpeed : number | The character's maximum reverse speed. |
.maxSpeed : number | The character's maximum speed. |
.meshBody : Mesh | The body mesh. |
.meshWeapon : Mesh | The weapon mesh. |
.root : Object3D | The root 3D object |
.scale : number | The mesh scale. |
.skinsBody : Array.<Texture> | The body skins. |
.skinsWeapon : Array.<Texture> | The weapon skins. |
.transitionFrames : number | The transition frames. |
.weapons : Array.<Mesh> | The weapon meshes. |
Methods
| Method | Description |
|---|---|
.enableShadows( enable : boolean ) | Toggles shadow casting and receiving on the character's meshes. |
.loadParts( config : Object ) | Loads the character model for the given config. |
.setAnimation( animationName : 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. |
.setVisible( enable : boolean ) | Toggles visibility on the character's meshes. |
.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. |
.shareParts( original : MD2CharacterComplex ) | Shares certain resources from a different character model. |
.updateAnimations( delta : number ) | Updates the animations of the mesh. Must be called inside the animation loop. |
.updateBehaviors() | Updates the animation state based on the control inputs. |
.updateMovementModel( delta : number ) | Transforms the character model based on the control input. |