Animation / Stance
Stance Class
Basic stance
The basic stance includes animation state machines for ground, flight and swimming. When you directly enter the game without any modification, all kinds of actions such as walking, running and jumping of character are performed by it.
The basic stance asset is an external asset. You can find and download them under the basic stance category in the local asset library.
Stance How does it work?
To play the basic stance, first execute the loadStance method in the Character class. Load a base stance object.
You can modify some property of this basic stance object and call the play method. The basic stance asset will be downloaded and loaded asynchronously when call play.
To stop a basic stance object, you can directly call call on the basic stance object.
Hierarchy
StanceBase
↳
Stance
Table of contents
Accessors
aimOffsetEnabled(): boolean other |
---|
Enable aim offset |
assetId(): string |
Attitude Resource Identifier |
Methods
play(): boolean other |
---|
Play posture |
stop(): boolean other |
Stop posture |
Accessors
aimOffsetEnabled
• | • | ||||
---|---|---|---|---|---|
Enable aim offset Precautions Whether the character has enabled aiming offset. True means enable, and false means disable. Aim offset is used to create a multi-directional weapon aim hybrid structure, and then superimpose and apply it to the default aim pose. Usage example: drag the used asset: "23442316081" into the priority loading column. Create a script named "Example_Stance_AimOffsetEnabled", place it in the object bar, open the script, enter the following code to save it, run the game, load a anime basic male stance and a anime basic female stance on the Player's character, press the keyboard "1", switch between playing anime basic male stance and anime basic female stance. You will see the effect of character's different stance in the scene. Press "2" on the keyboard to stop playing the basic stance. The code is as follows: ts Returns
| Enable aim offset Precautions Whether the character has enabled aiming offset. True means enable, and false means disable. Aim offset is used to create a multi-directional weapon aim hybrid structure, and then superimpose and apply it to the default aim pose. Usage example: drag the used asset: "23442316081" into the priority loading column. Create a script named "Example_Stance_AimOffsetEnabled", place it in the object bar, open the script, enter the following code to save it, run the game, load a anime basic male stance and a anime basic female stance on the Player's character, press the keyboard "1", switch between playing anime basic male stance and anime basic female stance. You will see the effects of different poses of characters in the scene. Press keyboard "2" to stop playing the basic posture. The code is as follows: ts Parameters
|
assetId
• |
---|
Attitude Resource Identifier Usage example: Drag the resource "234423216081" into the priority loading bar. Create a script named "Example_Stande_AssetId", place it in the object bar, open the script, enter the following code to save it, run the game, load a anime basic male stance and a anime basic female stance on the Player's character, press the keyboard "1", switch to play the anime basic male stance and anime basic female stance. You will see the effect of character's different stance in the scene. Press "2" on the keyboard to stop playing the basic stance. The code is as follows: ts Returns |
string |
---|
Methods
play
• play(): boolean
other
Play posture
Returns
boolean | The playback result will return false when the asset is not loaded, but the asset will be loaded asynchronously internally and played after completion. |
---|
Precautions
Play the stance object and return the execution result Whether this operation will automatically synchronize multiple ends depends on the call end, the server side broadcasting takes effect, and the client side takes effect locally.
Usage example: drag the used asset: "23442316081" into the priority loading column. Create a script named "Example_Stande_Play", place it in the object bar, open the script, enter the following code to save it, run the game, load a anime basic male stance and a anime basic female stance on the Player's character, press the keyboard "1", switch between playing anime basic male stance and anime basic female stance. You will see the effect of character's different stance in the scene. Press keyboard "2" to stop playing the basic posture. The code is as follows:
stop
• stop(): boolean
other
Stop posture
Returns
boolean | Stop result |
---|
Precautions
Stop this posture object and return the execution result Whether this operation will automatically synchronize multiple ends depends on the call end, the server side broadcasting takes effect, and the client side takes effect locally.
Usage example: drag the used asset: "23442316081" into the priority loading column. Create a script named "Example_Stande_Stop", place it in the object bar, open the script, enter the following code to save it, run the game, load a anime basic male stance and a anime basic female stance on the Player's character, press the keyboard "1", switch to play the anime basic male stance and anime basic female stance. You will see the effect of character's different stance in the scene. Press "2" on the keyboard to stop playing the basic stance. The code is as follows: