My First: Character Animation
Contents
My First Character Animation
For all the following examples we'll use one character: A Bear.
In the example is included:
- A combat set: draw, hit, hit UA (combat hit), attack, stow
- An idle set: idle, Still
- A skill set: rush prepare, rush cast
- A movement set: walk (f_normal), run (f_fast)
We'll also use an Animation Set Resource set up for a character.
I hope by now you are familiar with how to assign animation data and how to export and import the animations.
We'll start right away with data already present in the engine.
Add an animation set resource and open it. Assign the character animation set type and add an unarmed subset.
Assign the animations to the following slots:
- Default Animation Subset
- dodge slot: dodge_01
- dodge_backstab slot: dodge_01
- run slot : F_Fast_01
- walk slot : F_Normal_01
- hit slot: Hit_01
- hit_backstab slot: Hit_01
- hit_magic slot: Hit_01
- idle1,2,3 slots: Idle_01
- still slot: Still 01
- Unarmed(UA) Animation Subset:
- attack 1,2,3 slots: Attack_UA_01
- dodge slot: dodge_UA_01
- dodge_backstab slot: dodge_UA_01
- hit slot: Hit_UA_01
- hit_backstab slot: Hit_UA_01
- hit_magic slot: Hit_UA_01
- idle 1,2,3 slots: Still_UA_01
- still slot: Still_UA_01
- unsheat slot: Draw_UA_01
- sheat slot: Stow_UA_01
- Skills Animation Subset:
- skill_cast_rush_01_cast: Cast_Rush_UA_01_Cast
- skill_prepare_rush_01_start: Prepare_Rush_UA_01_Start
- skill_prepare_rush_01_loop: Prepare_Rush_UA_01_Loop
Once all the slots are filled in open the bear model resource and assign the animation set we just made to the first slot in the bear it's Animation Waterfall.
Assign the animation to the empty slot in the animation waterfall and apply the changes
My First Idle Animations
The idle animations are the easiest animations to implement. You have one still slot per state group. i.e. one for out of combat and one for each weapon type the character can use.
Per state group there are multiple idle slots. The engine automatically cycles through idle and still slots if a character is doing nothing.
The still is the default state so it needs to be looping
To make an animation looping select it in the content browser make sure the preview panel is visible and check looping checkbox in the side bar bellow the preview panel.
If the animation is open in the text key editor you can also check looping in the animation properties panel.
You won't need to add any text keys either unless your creature breathes fire while idelling, then you'll need an effect text key.
If you're character tramples in place you'll need to add a footstep text key.
My First Run/Walk Animations
The run walk animations are still fairly easy to implement. They need to loop like the still animation because thye can repeat for as long as a character moves.
The walk run animations require a bit more effort to have it interact with the sounds in the game.
When a character runs or walks we want to hear their footsteps. To do this open the animation resource or the animation set and then click the Text Keys button.
To add a footstep text key right click the animation timeline and select Left or Right foot. Left and Right are defined by what the character itself would consider left and right.
These text keys contain information that is used by the root template it's footstep property list.
The footstep property list defines which bone and effect is associated with the footsteps defined in the animations of a character.
Important for making the distinction on with the text key is the foot id. As a rule of thumb the numbering in the characters is from left to right, front to back as it would be for the creature itself.
in the case of our bear this means:
- front left paw is 0
- front right paw is 1
- back left paw is 2
- back right paw is 3
the type of sound that is player is define by the footstep weight on the character roottemplate.
In the case of player characters equipment also defines the footstep sounds.
My First Combat Animations
The combat animations are a bit more complex:
- When a draw or stow animation plays we need to signal to the engine that the character is drawing it's weapon (even when it is unarmed).
- When a character gets hit we want the combat grunts to play.
- When a characte dodges or blocks an attack we don't want combat grunts to play.
- When a character attacks we want to signal to the engine when a hit would connect.
Draw and stow
The draw stow in the case of the bear and unarmed animations merely require a switch text key to be present.
To get a switch text key right click on the animation timeline and select switch.
The funciton of this key is to indicate when an equiped weapon should appear in a character it's hands.
So in the case of player characters move the switch key to the moment where the character takes out it's weapon or puts it away in the animation.
Hit and dodge
This is much like the walk and run nanimations. they don't need to loop, but it's nice to have the movement of the character it's feet be registered with footstep keys.
Attacks
An attack animation needs to indicate when it would be connecting with it's target. We do this with a hit text key
To get a hit text key merely right click on the animation timeline and select hit out of the list.
When a hit text key gets executed it shows the impact numbers of the hit in game.
My First Skill Animation
Skill animations have a rather specific structure due to Divinity: Original Sin 2 being a turn based game.
This means that when a player is trying to decide where to use a skill the character already starts preparing the skill. Much like a still and walk a skill prepare needs to loop.
Additionally skill animations interact with the skill data. Once a character gets certain animations assigned it can execute skills that relly on those animations being present.
Skills do relly on a few signals coming from the animations. The most common signal being cast on the cast animation.
When making animations for skills it's a good idea to look how the text keys are set on the an existing player character's their equivalent skill animations.
The cast signal usually functions like the hit text key on an attack. It's when the animation would be executing the action of the skill
To add a cast text key right click on the animaiton time line and select cast from the list.
In the case of the rush skill (this animation slot is used by the battering ram skill) there is also movement of the character involved in the attack.
To indicate where the movement happens in the animation you use move_start and move_end text keys.
To add a move_start or move_end text key right click on the animaiton time line and select move_start or move_end from the list.
Testing character animations in game mode
To test a character in the engine you'll need to make a character root template.In the root template panel add a new root template.
Set the type to character and fill in physics and visual resource with the character physics and model.
This creates the character from scratch. Preferable you find a creature that almost behaves like the creature you're making in the root templates and copy that.
To copy an existing root template and it's functions right click on the root you want to copy and select Create new from selected....
In this window to root type is locked. Set the Visual resource and Physics resource just like you would with a new root template..
Put this newly made or copied root in an appropriate folder and then place it in your level. Open the side bar panel with the character in the level selected and check the Player checkbox.
Start game mode and open the remote console with CTRL+SHIFT+F11.
In the remote console type oe animtest <animation slot name>. This should play the animation once.
To loop the animation type oe animtest <animation slot name> -1.
To end a loop test type oe animtest stop.
For more information on: |
The Remote Console: ReCon |
Remote Console Commands: Command_list |
But I want to have a humanoid player character!!!
For player characters all the same principles apply. The main difference is that they need to support every weapon set type rather than just a few.
The basics remain the same. Every set will need an idle, move and attack set and skills depends on the animations the skill requires.
Animations called via scripts can have their own unique slot names. The slot name determines the name for the script to play the animation.