Nearly all default animations in the package are created with challenger model and its skeleton.
Height requirement when creating a player is set because of that.
Some animations ( like ladder climbing ) require a player to be of challenger model size or they won't fit ( maybe unless you go scaling both – I didn't try that though).
Also, Unity retargeting system is not all powerful, if a skeleton of your imported model differs greatly from the challenger, issues may arise.
No doubt, it's better to use animations with skeleton used on a player and/or other NPC models, so a user will most certainly want to replace current or add additional new
animations.
Player animations can be replaced directly in animator which is, by default name, called
'PlayerAnimatorCombatFramework'.
It can be found in the 'Resources/Animators/' folder.
Animations on per weapon basis are set on each weapon in 'AnimationClipList' component.
Replacing attack animation:
Attack animation can be made of a single attack or attack combo.
Key events in attack animation are 'AttackStartEvent', 'AttackHitEvent' and 'AttackComboEndEvent'.
Also, 'BreakComboEvent' event can be placed on key where
you want to attack swing to end. If 'BreakComboEvent' is not placed, an attack will end on next 'AttackStartEvent' if the input key is not pressed.
'AttackStartEvent' and 'AttackHitEvent' hold important attack
parameters.
'AttackStartEvent' parameters:
- int parameter – attack type is assigned.
Attack type is passed to an attacked character and take hit
and block hit is determined by it.
For instance, if the assigned attack type is 1, the attacked
NPC will start 'TakeHit1' animation or 'BlockHit1' if NPC is
blocking.
If 'TakeHit' + attack type cannot be found in NPC animator
then it will play default take hit animation ( 'TakeHit0' )
Also if 'BlockHit' + attack type cannot be found, the system
will play default block hit animation ( 'BlockHit0' )
- float parameter – additional damage per swing.
Additional damage can be assigned on per attack basis.
'AttackHitEvent' parameters:
- float parameter – attack angle of the current swing.
An attack is calculated by attacker current weapon reach and
angle to the target. Here you enter attack angle of current
attack swing.
- int parameter – attack source.
An attacker can be equipped with one weapon, two weapons
or no weapons. An attacker can also attack and hold two
weapons and attack with a kick followed with a right-hand
weapon and then a left-hand weapon. So int parameter
assigns what is the current source of an attack.
0 – primary /right-hand weapon.
1 – secondary /left-hand weapon.
2 –no weapon attack – like kick or punch.
'BreakComboEvent' and 'AttackComboEndEvent' do not take
any parameters.
Attack animations, same like all other animations, also can take the following curves:
- 'pLeftHandIKWeight' - controls left hand IK weight value in IK system.
- 'pRightHandIKWeight' – controls right-hand IK weight in the IK system.
- 'pLeftFootIKWeight' – control left foot IK weight in the IK system.
- 'pRightFootIKWeight' – control right foot IK weight in the IK system.
If an attack is made by two-handed weapon and left hand is
gripping two-handed weapon then set 'pLeftHandIKWeight'
curve to 1.
More on IK in IK section.
Replacing draw / sheathe weapon animations
When replacing one of the draw or sheathe animation it's important to look at the current one in the project to see what events are necessary for proper function.
Each of the 'draw weapon' animations needs to call that weapon type events.
For instance, drawing one-handed weapon require 'OnTakeWeaponEvent' on a place where hand takes a weapon and 'OnTakeWeapon1HEnd' on the end of an animation.
Sheathing of heavy melee weapon requires 'OnSheatheHeavy' set on a place where character hand is releasing weapon and 'OnSheatheHeavyEnd' at the end of an animation.
Also, you can set curve 'pLeftHandIKWeight' that controls left hand IK weight value in the IK system.
Replacing Recoil And Reload
Recoil animations need to have 'OnRecoilEnd' event set at the end of an animation.
Reload animation need to have 'EjectClip', 'GrabNewMag', 'Reload' and 'ReloadEnd' events set.
At 'EjectClip' event old magazine clip is discarded. 'GrabNewMag' event spawns new magazine in player left hand ( at 'Left Hand Holding Transform' field assigned in
'PlayerControlBase' component ). 'ReloadEnd' event is placed at the end of reload animation.
These are not all examples but important is, when replacing
animation, to look at the old and see what events and curves
animation need and create them.