My original tutorial for setting up Mecanim animations in ORK proved to be quite popular. But it's almost three years old now, and... to be honest, I was still relatively new to Unity development and I didn't get everything right the first time around. I have learned so much about Mecanim during that time that I need to do a complete rewrite, rather than simply updating my original tutorial.
So this is the long-awaited, comprehensive guide to setting up Mecanim animations for ORK. Unlike the previous tutorial, I'm going to start with the basics. This isn't going to be a beginner's guide to Mecanim, but I am going to cover some topics that some readers might find overly basic. Please bear with me; I will get to the more advanced stuff in due time.
I will be structuring this tutorial in more of a step-by-step flow than I did in my original. I will be using free animations which you can download from Mixamo if you wish to follow along. I will be using their "Y Bot" character model for downloading the animations, as it is a good neutral model to use. If you have a specific model that you want to use instead, you can upload the model to Mixamo before downloading the animations. This will help with retargeting the animations to fit your character model's rig. So anytime I mention the Y-Bot just substitute your own character model; for the purpose of this tutorial, I am simply going to assume the use of the Y-Bot.
One nice thing about using the free Mixamo animations is that they aren't completely set up for Unity when you download them, so in preparing them for use, you finally get to understand all of that stuff about baking Root Motion into the pose and all that. ;-)
The content of this tutorial is applicable to both turn-based and real-time games, but it is somewhat tailored to turn-based games or real-time games with an indirect control scheme (i.e. click-to-move such as in Baldur's Gate). For real-time games with a direct control scheme (such as Skyrim, Gothic, Zelda, etc), I find that an advanced character controller asset is better suited, as they can provide more fluid and responsive controls.
If you're not using animations from Mixamo, then you can obviously skip over the Downloading section. Depending on which animations you are using, you might need to tweak the animation import settings manually.
1. Download the Animations
Log in to Mixamo (register an account if you haven't already done so). If the Y-Bot isn't already selected, click the Characters tab and search for "Y Bot". Select this model and it will load into the preview pane on the right side:
Next, we will download two animations packs: the Male Locomotion Pack and Female Locomotion Pack. Click on the Animations tab and search for "Locomotion Pack":
First, select Male Locomotion Pack. It will take a moment to be applied to the preview panel. Once this is done, click on the yellow Download button. Make sure you change the Format to "FBX for Unity(.fbx)" as the default "FBX" option isn't optimized for Unity. Repeat this to download the Female Locomotion Pack.
2. Preparing Your Animations
Go ahead and import the Male Locomotion Pack into Unity. It doesn't matter where you put it, but I like to put all animations in Assets/Animations/[author]/[pack name].
The first thing that you'll need to do after importing any Mixamo animations is to configure them to use the Mecanim Humanoid rig; by default, they all import with the Mecanim Generic rig:
Now, you can leave the "Avatar Definition" as the default "Create From This Model" for all of the files, but this creates an identical avatar definition for each .fbx file (and the Mixamo animations are one animation clip per file). This is unnecessary and clutters up the view when you have a "Select Avatar" dialog window open.
So what I prefer to do after importing a pack is to first configure the Y-Bot model as Humanoid:
Then I'll select all of the animation files as one group, set them to use the Humanoid rig, and then copy the avatar from the Y-Bot model:
Optional: And just because I really like keeping things neat and tidy in my projects, I also uncheck "Import Animations" on the Y-Bot model, as it doesn't actually contain any animations. If you look, you'll often see that this is checked on many models of swords, buildings, etc that you purchase from the Asset Store.
Go ahead and repeat this same process for the Female Locomotion Pack.
Optional: If you really want to streamline things, you can get rid of the ybot model included in the pack and use the same avatar that you used for the Male Locomotion Pack. If you do this, I recommend moving the Y-Bot model up into the "Mixamo" folder so that it's easy to find, as you can copy its avatar definitions when setting up any of the animations that we'll download from Mixamo in this tutorial.
Because the walk and run animations are identically timed between the Male and Female Locomotion Packs, there is a neat trick that we can do to blend the male and female animations together to allow for greater variety in movement. But we'll get to that when we start setting up the Animator Controller.
Animation Import Settings
There are only three animations that we really need from each of these two packs: the Idle, Walk (forward), and Run (forward) animations. You can safely delete the others.
When Adobe put Mixamo into "maintenance mode" a couple of years ago, they restructured all of the animations and now when you import directly from the files you download from Mixamo, the animation clip inside each file is simply named "mixamo.com":
It's super annoying, as when you drag an animation clip onto the animator controller, it creates a state with the same name as the animation clip. So I usually modify the name of the animation clip to match (or mostly match) the name of the file at the same time that I modify the other import settings.
You will sometimes see a message that reads "The clip range is outside of the range of the source take." When you see this, just press the button next to it labeled Clamp Range:
Use these settings for the Idle animation in both packs:
I have found with the Mixamo animations that the Root Transform Rotation needs to be baked as Original and not Body Orientation. Within a single set of animations, Body Orientation usually works well, but if you need to blend into animation clips that aren't part of the set (for example, if the set is missing a "hit reaction" animation), then the character can end up flipping around.
For most animations, we will bake Root Transform Position (Y) into the pose, Based Upon the character's Feet. This eliminates any up and down movement that isn't supposed to be there. Unless the animation involves jumping or falling, we're going to be using this setting.
Baking Root Transform Position (XZ) into the pose will eliminate any shifting that occurs as a result of the animation. I've ended up using Original for some animations, but using Center of Mass for others. This one in particular seems to require the most trial and error to find what looks best.
Apply these settings to the Walk and Run animations in both packs:
3. Set Up Your Animator Controller
Create a new Animator Controller. Name it whatever you like; I named mine "ORK Default Humanoid."
Right-click on the canvas and select Create Sub-State Machine (I will use the abbreviation SSM in the future). Name your new SSM "Unarmed" -- later on, we will create SSMs for different animation sets. This is a good way to help keep your animator organized.
Double-click on the Unarmed SSM to open it. Right-click on the canvas and select Create State -> From New Blend Tree (Unity Manual: Blend Trees). Name this state "Idle" and then repeat this two more times to create Blend Tree states for Walk and Run.
If you recall, I mentioned when we downloaded the animations that we can blend the male and female animations together to create some variation in movement. Add a new float parameter to your animator controller and name it "Femininity." This parameter will be used to set the blend weight of the male and female animations. It should always be set to a value between 0 and 1 (inclusive); this is what is referred to as a normalized value.
Double click on Unarmed Idle and you"ll see an empty Blend Tree:
Click on the Blend Tree node and you'll see that it defaults to a 1D Blend Type; as we only have the one float parameter on our controller, it will be selected by default:
We only need to blend based on this single value, so a simple ID Blend Tree is appropriate. Click the plus sign at the bottom of the empty list and select "Add Motion Field" then assign the Idle animation clip from the Male pack (not the .fbx file; you have to select the actual animation clip within the file). Add another motion field, and assign the Idle clip from the Female pack:
The auto thresholds work well for this. When the Femininity parameter is 0, the resulting animation is 100% from the male idle; when the parameter is 1, the resulting animation is 100% from the female idle. You can test how the Blend Tree works by pressing play in the animation preview window and then moving the "Femininity" slider back and forth to see how the blending is weighted as you change the value. I find that a value of 0 to 0.15 works well for male characters, and 0.8 to 1 for female characters.
4. ORK Setup
In the ORK Framework Editor, create a new Animations setting (or modify your default one):
To avoid having multiple characters animating perfectly in sync with one another, check Random First Start Time so that the first animation doesn't start at exactly the same time.
Optional: I also like to check Set Animator Speed with a random value from 0.9 to 1.1 -- you need to be careful with this, as it sets the speed of every animation and thus will also affect walk and run animation speeds. For turn-based games, it's not really an issue. I find that a 10% variance in either direction looks good without having a noticeable effect on gameplay.
The Mecanim animator can play animations directly (by providing the name of a specific state to play) or using its own logic to apply transitions based on the values of parameters that have been set up on the animator controller and updated via script. We will eventually be using both methods, but since we're going to be using ORK's Auto Move Animation for our Combatants, we'll play the animations directly using the Animator's Cross Fade play mode to start our locomotion animator states (Idle, Walk, and Run). This will give us a smooth transition between these states.
Add an Idle animation to this animation set:
Animator.Play() and Animator.CrossFade() both use the State Name in order to play the animation. We created our Idle, Walk, and Run states inside of a sub-state machine named "Unarmed" and thus when we wish to play a state within a sub-state machine, we include the name of the sub-state machine. If you just specify "Idle" then it will play the first state that it finds named "Idle" in your animator controller. Animator state names only have to be unique within a state machine. So we play this basic idle as "Unarmed.Idle".
Add Walk and Run animations with the same settings:
Now, modify the player Combatant to use these animation settings:
You can use the Y-Bot model in your player prefab to test this out (or any other Humanoid-rigged model of course). If you're using click-to-move player controls with a NavMeshAgent (NMA), I find that the Angular Speed and Acceleration values need to be increased; Angular Speed 360 and Acceleration 20 work reasonably well, in my experience.
Part 2: Battle Mode Animations (Basic) - Initial Setup
In this part of the tutorial, we will set up animations that will be used when specific types of weapons are equipped. Generally, these will take effect when you are in Battle Mode, so that is the context that I will assume throughout Part 2.
As this part is labeled Basic, I will be saving more complex setups, such as using up multiple variant animations for different actions (such as based on what direction an attack was coming from), for when we get to Part 3: Battle Mode Animations (Advanced).
We will be setting up battle animations for a one-handed sword (and shield), two-handed sword, one-handed axe, bow and arrow, and spell-casting. I chose these because those are the animation packs that you can freely download from Mixamo. (Note: I won't be posting all 5 initially; you'll have to wait for a couple of them).
If you're not using animations from Mixamo, then you can obviously skip over the Downloading section. Depending on which animations you are using, you might need to tweak the animation import settings manually.
1. Download the Animations
Follow the same general procedure as in Part 1 (use the Y-Bot model for downloading, etc) to search for and download the following animation packs:
Pro Sword and Shield Pack
Pro Melee Axe Pack
Pro Magic Pack
Pro Longbow Pack
Great Sword Pack
I would suggest unzipping each pack into its own subfolder within Assets/Animations/Mixamo/, but you are free to place the animations wherever you wish.
We don't have an animation appropriate for the "Use" action (in this context, drinking a potion), so we'll grab one single animation as well. Search for "drinking" and select the first result:
In the Download Settings, set it to Skin: Without Skin. This is optional; it will work fine if you download the skin, but this just includes the materials for the Y-Bot in each animation file, and this is unnecessary (and takes up extra space):
2. Preparing Your Animations
Keep in mind that all of the animations will import as the "Generic" Mecanim rig, so you will have to change everything over to "Humanoid" as covered in Part 1. I would recommend deleting the ybot model from each of the animation packs and copying the avatar from a single reference model (again, as I explain in Part 1).
Many of the animations contained in the packs won't be used, so don't worry about configuring all of the animation import settings on each file just yet. We'll do that as we need them. And this is where it pays off to rename the "mixamo.com" clip in each file as we configure its import settings, as it's then easier to see which clips we're using and which we're not.
3. Set Up Your Animator Controller
We're going to need to extend the setup of our animator controller in order to support what we need to do with our weapon set animations, so I'll start with the base setup before moving on to setting up each individual weapon set.
Animator Layers
Please read the Unity Manual page on Animation Layers if you are not familiar with how they work. It also describes avatar masks, which we will need to make use of.
We will be using multiple layers on our animation controller. The Base Layer on which you added the locomotion states (Idle, Walk, Run) in Part 1 is only going to be used for character locomotion. When an animator controller has multiple layers, each layer has priority over all of the others that appear above it in the Animator window.
In this Basic tutorial, we will make use of one additional masked animator layer. All of the battle actions (Attack, Cast, Damage, Death, Defend, Use) will play on the Full Body layer. Because this layer is masked to the full skeleton, any animations that it plays will override all animations on all other layers
We'll get into this in further detail on avatar masks and animator layers in Part 3: Battle Mode Animations (Advanced).
Add a new animator layer and name it Full Body. It will automatically be selected for you, so right-click on the canvas and select Create State -> Empty. Rename the new state to "Empty" -- this state should always be the default layer state and thus colored orange. By defaulting to an Empty state on this layer layers, it will default to not contributing anything to the final animation, leaving only animations on the Base Layer playing.
You will now need to create an Avatar Mask for each this layer. Create a new folder inside the same folder that you store your animator controllers and name it "Avatar Masks." Right-click on this folder and select Create -> Avatar Mask. By default, everything is selected, so all you need to do is rename it to "Full Body."
Click the gear on the right side of the Full Body layer and assign the avatar mask that you just created. You have to do by clicking the circle next to the Mask field and selecting it via the dialog window that opens up. If you try to drag an avatar mask, the layer settings box will disappear. Make sure you set the Weight to 1, or else the layer won't be factored into the final animation result.
When a mask has been applied, an "M" appears on the animator layer:
The MoveSetID Parameter
Add a new Int parameter to your animator controller named MoveSetID -- we will use this Parameter in conjunction with Trigger parameters to determine the specific animation to play for an action.
It can be difficult to remember what a numeric parameter is supposed to represent, so we'll pre-define a few blocks of numbers for our MoveSetID parameter:
0 - 9
Unarmed
10 - 19
One-Handed Melee Weapons
20 - 29
Two-Handed Melee Weapons
30 - 39
Ranged Weapons
40 - 49
Magic/Special Abilities
For the animation sets that we'll be setting up in this tutorial, I have chosen the following MoveSetID values:
0
Default Unarmed
12
One-Handed Swords (and optional Shield)
13
One-Handed Axes
20
Two-Handed Swords
30
Bows
40
Spellcasting
This leaves us with plenty of unused values within each block of numbers so that we can extend our game with additional animation sets without having a jumbled mess of ID values. If you think that you need more than 10 for each broad category, then I would suggest using three-digit values (so 100-199 for One-Handed Melee, etc).
Mixamo doesn't have a set of sword-only animations, so we'll need to use the Pro Sword and Shield Pack regardless of whether or not the character has a shield equipped.
Action Parameters
We'll be using Trigger parameters to play the animations for specific actions. Add the following Trigger parameters to your animator controller:
Attack
Cast
Damaged
Defend
Die
Use
Sub-State Machines
The animator states for each weapon type will be contained within its own sub-state machine (SSM) on each animator layer. The SSM names that I will be using are:
Unarmed
SwordShield
Axe
GreatSword
Bow
Spellcasting
Here's a secret... we're only ever going to start animations by their state names with Idle, Walk, and Run so technically it doesn't matter what you name the SSMs other than the Base Layer. But let's keep thing consistent and organized!
The next post will cover setting up your first set of weapon type animations.
Now is the time to set the animation import settings on your idle, walk, and run animations for the Pro Sword and Shield Pack and assign them to the appropriate animator states. Refer to Part 1 for explanations of the Root Transform baking settings.
For some unknown reason, the neutral idle animation is in the sword and shield idle (4) file, so make sure that you use that one in your SwordShield.Idle state.
If you rename the animation clips from "mixamo.com" to "Idle," "Walk," and "Run" then you can just drag the animation clips onto the canvas without having to rename the state afterwards.
On the Base Layer of your animator controller, create a new SSM named SwordShield. Double-click on the SSM to open it, and then drag your Sword & Shield Idle, Walk, and Run animations to the canvas (we're not using a Blend Tree this time). Create Idle first so that it is the StateMachine Default State.
This shouldn't make any difference, as nothing will ever start the state machine on its own, but it's a good practice. If you need to reassign the default state, right-click on the Entry node and select Set StateMachine Default State. Make sure you don't set it as the Default Layer State; that should always be Unarmed.Idle.
Set Up Combat Actions
First, we'll need to set the animation import settings on the clips that we will need. You can rename the "mixamo.com" clip to anything you want for these, as we're using triggers to start the animations and not the state names. I like to use more descriptive names than "Attack 1," "Attack 2", etc.
For the Attack animation, we'll use the forward slash animation in sword and shield slash:
For the Cast animation, we'll use the left-hand casting animation in sword and shield casting (2):
For the Damage animation, we'll use the hit-from-front reaction in sword and shield impact (3):
For the Death animation, we'll use the die-and-fall-backward animation in sword and shield death:
For the Defend animation, we'll need to string together three animation clips: the start blocking clip in sword and shield block, the end blocking clip in sword and shield block (2), and the block idle clip in sword and shield block idle:
Switch to the Full Body animator layer and create a new SSM named SwordShield.
Drag the Attack, Cast, Damage, and Death animations into the SwordShield SSM (still on the FullBody layer). Because the Defend action is a bit more complex, we'll create a "Defend" SSM to hold its states (go ahead and create that now).
When all of the transitions are hooked up, my SwordShield SSM looks like this:
Now, we'll create the transitions into these states.
Right-click on the Any State node and Make Transition to the Attack state ("Forward Slash" in my screenshot). Use these transition settings:
Unchecking "Can Transition to Self" prevents another transition into the state while it is currently running. We want that for all of these.
Repeat this for the Cast, Damage, and Death animation states as well, but set the appropriate trigger parameter for each. Here's a great shortcut that was added a little while back: if you right-click on a transition in the "Transitions" list in the inspector ("AnyState -> Forward Slash" in my screenshot), you can select Copy Transition Parameters; when you create a new transition to another state, you can right-click on it in the inspector and then paste the settings, the conditions, or both! I was very, very happy to discover this. Node that pasting the settings DOES NOT paste Can Transition To Self (or Interruption Source), so that has to be set manually.
When the Attack, Cast, and Damage states finish playing, we want to transition back to the root Empty node outside of the SwordShield SSM so that the Full Body layer is only active while animating a discrete action. Once the character should go back to an idle or movement state, the Base Layer takes over.
Create a new transition from the Attack state to the orange (Up) Full Body node and select States -> Empty. Use the following transition parameters:
When Has Exit Time is checked, the state will play until the animation is finished. These animations all return to the base idle animation when complete, so we'll use Exit Time 0.9 (normalized time where 0 = the first frame of the clip and 1 = the last frame) with a brief Transition Duration of 0.1s. We don't need any conditions for these; they simply exit when finished playing.
Repeat to add exit transitions from the Cast and Damage states to the root Empty state.
Note that you don't want a transition out of the Death state, as when that animation has finished, you want the character to stay in that pose from the last frame.
Open up the Defend SSM and drag the three Block animations into it. When the transitions are hooked up, mine looks like this:
Right-click on the Any State node and Make Transition to the Block Start state:
Then add a transition from Block Start to Block Idle. Ensure that this has "Use Exit Time" checked:
Add a transition from Block Idle to Block End. Playing the whole sequence of the three states is perhaps a bit long, so we'll set the Exit Time to 0.5 -- this is normalized state time, so that means halfway through the clip:
Finally, we need to transition from Block End back to the Empty state outside of the SwordShield SSM:
The Use Animation
Before we finish with the animator setup, we still need to add an animation for the Use action. For this basic tutorial, we're just going to set up the "Drinking" animation that we downloaded and hope that nobody ever uses an item other than a potion. :-)
Start with the animation import settings on the clip within the ybot@Drinking file. You'll note that the character is in a neutral idle stance and not the battle-ready idle stance used by the Sword and Shield animations. It will look a bit odd transitioning from the battle-ready idle to a neutral stance and back to the battle-ready stance, but we work with what we have:
Because this animation isn't specific to the Sword and Shield animations, we'll go back to the top level of the Full Body layer and create an Unarmed SSM. Drag the Drinking animation clip into the Unarmed SSM.
If you play the Drinking animation, you can see that it doesn't so much represent a warrior frantically drinking a potion on the field of battle, but somebody taking a drink while socializing at a party. It's slow, and the character starts and ends holding his drink at around his midsection. No worries; we can work with this by setting a Transition Offset when we start the animation and by tweaking the Exit Time when we end it.
While we will add an entry transition from Any State and and exit transition back to the Empty state, those don't make it easy to test how the transition will look in the animation preview. So grab the Idle animation from the Male Locomotion Pack and drop it onto the canvas. Add a transition from Idle to Drinking, and from Drinking back to Idle. You can delete this Idle state once you've determined the transition settings that you want, but to ensure that it doesn't mess with anything if you go run the game, mute both of these transitions:
We want to find a Transition Offset time that looks good, so select the Idle -> Drinking transition. We're going to be playing this transition many times until we find a good offset value and the Idle animation is long, so set the Exit Time to 0.2 so that we don't get frustrated watching him just stand there:
We also need to have him take a drink with a little more urgency. Bump the playback speed in the animation preview up to 1.5 and play the part of the animation where he actually takes a drink. Okay, that looks better.
Move the play head of the preview window to the point in the Drinking animation where he just starts to raise his hand. You can see the white vertical line moving through the transition timeline as you move the play head. Then click on the "Drinking" clip in the transition timeline, right on the line (colored red in the image). Drag it left until your mouse pointer is within the blue shaded area that represents the transition duration:
You can click on the clip anywhere to drag it, but this way you're not just guessing and moving the clip back and forth in the transition timeline until you get it right. You may still need to tweak it a bit once you play the whole transition, but it should be pretty close.
A Transition Offset around 0.24 looks pretty good.
Next we need to find a good Exit Time. Select the Drinking -> Idle transition and move the play head to where he just finishes lowering his hand:
Now you can just grab the Idle state in the transition timeline and move it until its left edge is touching the white line:
I didn't do it here, but sometimes this process is easier (for both the entry and exit transitions) if you zero out the Transition Duration so that you can pinpoint the exact spot in the animation where you want to enter or exit, and then increase the duration until it looks smooth.
An Exit Time of around 0.65 looks good.
Add the transition from Any State to Drinking, with the Use Trigger parameter:
And the transition from Drinking back to the Empty node outside of the SSM:
Before we forget, we also want to change the playback speed of the Drinking animation, as we only changed the speed of the animation preview. Select the Drinking state and change its speed to 1.5:
You can also drag the Sword and Shield Idle onto the canvas and copy your transition settings so that you can see how those transitions look. As I said, it's a bit awkward how the stance changes, but there isn't much we can do about that here. The same settings look good enough. If you found that you wanted to change the Transition Offset or Exit Time, then you would just create additional transitions to or from the Drinking state, but also add MoveSetID = 12 to the condition(s).
4. ORK Setup
As the Drinking animation that we set up for the "Use" action is not specific to any one weapon animation set, add a "Use" animation type to your Default Humanoid animations settings:
Create a new Animations setting for the Pro Sword and Shield Pack animations:
Set up the Idle, Walk, and Run animations the same way that you did in Part 1 (but ensure they use the "SwordShield" SSM name):
Now we will add animations for animation types that represent discrete actions. All of these will use Play Mode: None, do not need a State Name or Layer Index specified, and will require (at least) two Play parameters: a Trigger and an Int parameter named MoveSetID with a value of 12.
Add a "Damage" animation type, using the Trigger parameter Damaged. Also set the Duration to 0.7s:
When you play a Mecanim animation with the Play Combatant Animation node in an ORK Event, the "Wait" setting doesn't work unless you have specified a Duration in the animation setting here. For the Damage animation, I just specify the length of the animation clip that we're using.
Add a "Death" animation type with the Trigger parameter Die. The animation clip has a duration of 2.3s.
Add an "Attack" animation type with the Trigger parameter Attack -- but this time we don't want the Duration to be the length of the animation clip. Normally, you're going to want to time the hit or miss sound and visual effects with the point where the attack would make contact with its target. If we use the full length of the clip, then when we Wait for the attack animation to finish, those effects will all be added after the attacker goes back into an idle pose, which looks kind of sloppy.
You'll need to find the timestamp within the animation clip where the attack would make contact. Most likely, you'll want this slightly before, to allow frame or two for the effects to be created or loaded. Select your attack animation clip in the Project view and manually move the position indicator in the preview window to the point of contact and then move it left about one frame back. This isn't an exact science and it will require some trial and error. I chose a point at 40% of the way through the 1.5 second clip, so that gives us a Duration of 0.6s -- all it really means is how long we want a Play Combatant Animation node to wait before proceeding to the next node.
If we specify the duration here, then we don't need to add a Wait 1s node in our Attack Battle Event, so the timing can easily match each weapon type's attack animations quite closely.
Add a "Cast" animation type with the Trigger parameter Cast:
As with the "Attack" type, we're using the timestamp in the casting animation where the spell effects should be spawned as our Duration:
Finally, add a "Defend" animation type with the Trigger parameter Defend and a Duration of 1.9s. Because we set the Exit Time of the Block Idle state to 0.5, I added the clip lengths of the Block Start and Block End to one-half of the Block Idle clip's length.
Please let me know if you come across any errors, stuff that I've missed, incorrect screenshots, etc.... This is a long and rather complex tutorial, so it's easy to make mistakes.
And of course, feel free to ask questions or let me know if I didn't explain something very clearly.
@KeldrynI don't understand one thing. The system seems to change MoveSetID value based on type of weapon used, however I don't understand how that works.
It looks I can just make an equip event that changes MoveSetID value, however I need to reequip weapon during combat for this to work, an weapon equipped before combat doesn't set MoveSetID.
The same problem applies to femininity.
I don't understand what triggers weapon idle/walk/ run states.
I also have a problem with enemies changing orientation after playing death animation.
Usually you'll have to set up those animations in ORK's animations and have the weapon override the combatant's animation settings. I.e. set up the animations that should be changed in Base/Control > Animations as a new animation setup. In the weapon's settings (Inventory > Weapons) enable using Own Animations (if it's only for battles, enable the Battle one) and select the animation setup that should be used.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
JMR said: I don't understand what triggers weapon idle/walk/ run states.
Just to clarify further upon what GiL wrote above:
The Combatants should have "Use Auto Animation" enabled under Automatic Move Animation (at the very end of Part 1, above). When using auto move animations, ORK will play the Idle/Walk/Run animations depending on the combatant's movement speed. In the animation setup above, we're using Animator.CrossFade() to play them by specifying the state name on the animator.
For the other types of animation, we're activating them on the animator controller by setting a Trigger parameter in conjunction with an int MoveSetID parameter. These animation settings are near the end of Part 2, above.
If you're using a different animator controller for each character, you can just set the Femininity parameter directly on the animator controller (I don't recommend this, as you don't really need a separate controller for each character). I would probably set it as a float object variable on each Combatant, and then write up a simple component that gets that float variable value and sets the Femininity parameter on the animator.
JMR said: I also have a problem with enemies changing orientation after playing death animation.
If you have a NavMeshAgent on the enemies, make sure that you disable it when the combatant dies.
Part 1: Movement in Field Mode
If you're not using animations from Mixamo, then you can obviously skip over the Downloading section. Depending on which animations you are using, you might need to tweak the animation import settings manually.1. Download the Animations
Log in to Mixamo (register an account if you haven't already done so). If the Y-Bot isn't already selected, click the Characters tab and search for "Y Bot". Select this model and it will load into the preview pane on the right side:Next, we will download two animations packs: the Male Locomotion Pack and Female Locomotion Pack. Click on the Animations tab and search for "Locomotion Pack":
First, select Male Locomotion Pack. It will take a moment to be applied to the preview panel. Once this is done, click on the yellow Download button. Make sure you change the Format to "FBX for Unity(.fbx)" as the default "FBX" option isn't optimized for Unity. Repeat this to download the Female Locomotion Pack.
2. Preparing Your Animations
Go ahead and import the Male Locomotion Pack into Unity. It doesn't matter where you put it, but I like to put all animations in Assets/Animations/[author]/[pack name].The first thing that you'll need to do after importing any Mixamo animations is to configure them to use the Mecanim Humanoid rig; by default, they all import with the Mecanim Generic rig:
Now, you can leave the "Avatar Definition" as the default "Create From This Model" for all of the files, but this creates an identical avatar definition for each .fbx file (and the Mixamo animations are one animation clip per file). This is unnecessary and clutters up the view when you have a "Select Avatar" dialog window open.
So what I prefer to do after importing a pack is to first configure the Y-Bot model as Humanoid:
Then I'll select all of the animation files as one group, set them to use the Humanoid rig, and then copy the avatar from the Y-Bot model:
Optional: And just because I really like keeping things neat and tidy in my projects, I also uncheck "Import Animations" on the Y-Bot model, as it doesn't actually contain any animations. If you look, you'll often see that this is checked on many models of swords, buildings, etc that you purchase from the Asset Store.
Go ahead and repeat this same process for the Female Locomotion Pack.
Optional: If you really want to streamline things, you can get rid of the ybot model included in the pack and use the same avatar that you used for the Male Locomotion Pack. If you do this, I recommend moving the Y-Bot model up into the "Mixamo" folder so that it's easy to find, as you can copy its avatar definitions when setting up any of the animations that we'll download from Mixamo in this tutorial.
Because the walk and run animations are identically timed between the Male and Female Locomotion Packs, there is a neat trick that we can do to blend the male and female animations together to allow for greater variety in movement. But we'll get to that when we start setting up the Animator Controller.
Animation Import Settings
There are only three animations that we really need from each of these two packs: the Idle, Walk (forward), and Run (forward) animations. You can safely delete the others.When Adobe put Mixamo into "maintenance mode" a couple of years ago, they restructured all of the animations and now when you import directly from the files you download from Mixamo, the animation clip inside each file is simply named "mixamo.com":
It's super annoying, as when you drag an animation clip onto the animator controller, it creates a state with the same name as the animation clip. So I usually modify the name of the animation clip to match (or mostly match) the name of the file at the same time that I modify the other import settings.
You will sometimes see a message that reads "The clip range is outside of the range of the source take." When you see this, just press the button next to it labeled Clamp Range:
Use these settings for the Idle animation in both packs:
You can read more about the animation import settings on the Animation Clip page in the Unity Manual, but a lot of it still comes down to trial and error.
I have found with the Mixamo animations that the Root Transform Rotation needs to be baked as Original and not Body Orientation. Within a single set of animations, Body Orientation usually works well, but if you need to blend into animation clips that aren't part of the set (for example, if the set is missing a "hit reaction" animation), then the character can end up flipping around.
For most animations, we will bake Root Transform Position (Y) into the pose, Based Upon the character's Feet. This eliminates any up and down movement that isn't supposed to be there. Unless the animation involves jumping or falling, we're going to be using this setting.
Baking Root Transform Position (XZ) into the pose will eliminate any shifting that occurs as a result of the animation. I've ended up using Original for some animations, but using Center of Mass for others. This one in particular seems to require the most trial and error to find what looks best.
Apply these settings to the Walk and Run animations in both packs:
3. Set Up Your Animator Controller
Create a new Animator Controller. Name it whatever you like; I named mine "ORK Default Humanoid."Right-click on the canvas and select Create Sub-State Machine (I will use the abbreviation SSM in the future). Name your new SSM "Unarmed" -- later on, we will create SSMs for different animation sets. This is a good way to help keep your animator organized.
Double-click on the Unarmed SSM to open it. Right-click on the canvas and select Create State -> From New Blend Tree (Unity Manual: Blend Trees). Name this state "Idle" and then repeat this two more times to create Blend Tree states for Walk and Run.
If you recall, I mentioned when we downloaded the animations that we can blend the male and female animations together to create some variation in movement. Add a new float parameter to your animator controller and name it "Femininity." This parameter will be used to set the blend weight of the male and female animations. It should always be set to a value between 0 and 1 (inclusive); this is what is referred to as a normalized value.
Double click on Unarmed Idle and you"ll see an empty Blend Tree:
Click on the Blend Tree node and you'll see that it defaults to a 1D Blend Type; as we only have the one float parameter on our controller, it will be selected by default:
We only need to blend based on this single value, so a simple ID Blend Tree is appropriate. Click the plus sign at the bottom of the empty list and select "Add Motion Field" then assign the Idle animation clip from the Male pack (not the .fbx file; you have to select the actual animation clip within the file). Add another motion field, and assign the Idle clip from the Female pack:
The auto thresholds work well for this. When the Femininity parameter is 0, the resulting animation is 100% from the male idle; when the parameter is 1, the resulting animation is 100% from the female idle. You can test how the Blend Tree works by pressing play in the animation preview window and then moving the "Femininity" slider back and forth to see how the blending is weighted as you change the value. I find that a value of 0 to 0.15 works well for male characters, and 0.8 to 1 for female characters.
4. ORK Setup
In the ORK Framework Editor, create a new Animations setting (or modify your default one):To avoid having multiple characters animating perfectly in sync with one another, check Random First Start Time so that the first animation doesn't start at exactly the same time.
Optional: I also like to check Set Animator Speed with a random value from 0.9 to 1.1 -- you need to be careful with this, as it sets the speed of every animation and thus will also affect walk and run animation speeds. For turn-based games, it's not really an issue. I find that a 10% variance in either direction looks good without having a noticeable effect on gameplay.
The Mecanim animator can play animations directly (by providing the name of a specific state to play) or using its own logic to apply transitions based on the values of parameters that have been set up on the animator controller and updated via script. We will eventually be using both methods, but since we're going to be using ORK's Auto Move Animation for our Combatants, we'll play the animations directly using the Animator's Cross Fade play mode to start our locomotion animator states (Idle, Walk, and Run). This will give us a smooth transition between these states.
Add an Idle animation to this animation set:
Animator.Play() and Animator.CrossFade() both use the State Name in order to play the animation. We created our Idle, Walk, and Run states inside of a sub-state machine named "Unarmed" and thus when we wish to play a state within a sub-state machine, we include the name of the sub-state machine. If you just specify "Idle" then it will play the first state that it finds named "Idle" in your animator controller. Animator state names only have to be unique within a state machine. So we play this basic idle as "Unarmed.Idle".
Add Walk and Run animations with the same settings:
Now, modify the player Combatant to use these animation settings:
You can use the Y-Bot model in your player prefab to test this out (or any other Humanoid-rigged model of course). If you're using click-to-move player controls with a NavMeshAgent (NMA), I find that the Angular Speed and Acceleration values need to be increased; Angular Speed 360 and Acceleration 20 work reasonably well, in my experience.
Part 2: Battle Mode Animations (Basic) - Initial Setup
In this part of the tutorial, we will set up animations that will be used when specific types of weapons are equipped. Generally, these will take effect when you are in Battle Mode, so that is the context that I will assume throughout Part 2.As this part is labeled Basic, I will be saving more complex setups, such as using up multiple variant animations for different actions (such as based on what direction an attack was coming from), for when we get to Part 3: Battle Mode Animations (Advanced).
We will be setting up battle animations for a one-handed sword (and shield), two-handed sword, one-handed axe, bow and arrow, and spell-casting. I chose these because those are the animation packs that you can freely download from Mixamo. (Note: I won't be posting all 5 initially; you'll have to wait for a couple of them).
If you're not using animations from Mixamo, then you can obviously skip over the Downloading section. Depending on which animations you are using, you might need to tweak the animation import settings manually.
1. Download the Animations
Follow the same general procedure as in Part 1 (use the Y-Bot model for downloading, etc) to search for and download the following animation packs:We don't have an animation appropriate for the "Use" action (in this context, drinking a potion), so we'll grab one single animation as well. Search for "drinking" and select the first result:
In the Download Settings, set it to Skin: Without Skin. This is optional; it will work fine if you download the skin, but this just includes the materials for the Y-Bot in each animation file, and this is unnecessary (and takes up extra space):
2. Preparing Your Animations
Keep in mind that all of the animations will import as the "Generic" Mecanim rig, so you will have to change everything over to "Humanoid" as covered in Part 1. I would recommend deleting the ybot model from each of the animation packs and copying the avatar from a single reference model (again, as I explain in Part 1).Many of the animations contained in the packs won't be used, so don't worry about configuring all of the animation import settings on each file just yet. We'll do that as we need them. And this is where it pays off to rename the "mixamo.com" clip in each file as we configure its import settings, as it's then easier to see which clips we're using and which we're not.
3. Set Up Your Animator Controller
We're going to need to extend the setup of our animator controller in order to support what we need to do with our weapon set animations, so I'll start with the base setup before moving on to setting up each individual weapon set.Animator Layers
Please read the Unity Manual page on Animation Layers if you are not familiar with how they work. It also describes avatar masks, which we will need to make use of.We will be using multiple layers on our animation controller. The Base Layer on which you added the locomotion states (Idle, Walk, Run) in Part 1 is only going to be used for character locomotion. When an animator controller has multiple layers, each layer has priority over all of the others that appear above it in the Animator window.
In this Basic tutorial, we will make use of one additional masked animator layer. All of the battle actions (Attack, Cast, Damage, Death, Defend, Use) will play on the Full Body layer. Because this layer is masked to the full skeleton, any animations that it plays will override all animations on all other layers
We'll get into this in further detail on avatar masks and animator layers in Part 3: Battle Mode Animations (Advanced).
Add a new animator layer and name it Full Body. It will automatically be selected for you, so right-click on the canvas and select Create State -> Empty. Rename the new state to "Empty" -- this state should always be the default layer state and thus colored orange. By defaulting to an Empty state on this layer layers, it will default to not contributing anything to the final animation, leaving only animations on the Base Layer playing.
You will now need to create an Avatar Mask for each this layer. Create a new folder inside the same folder that you store your animator controllers and name it "Avatar Masks." Right-click on this folder and select Create -> Avatar Mask. By default, everything is selected, so all you need to do is rename it to "Full Body."
Click the gear on the right side of the Full Body layer and assign the avatar mask that you just created. You have to do by clicking the circle next to the Mask field and selecting it via the dialog window that opens up. If you try to drag an avatar mask, the layer settings box will disappear. Make sure you set the Weight to 1, or else the layer won't be factored into the final animation result.
When a mask has been applied, an "M" appears on the animator layer:
The MoveSetID Parameter
Add a new Int parameter to your animator controller named MoveSetID -- we will use this Parameter in conjunction with Trigger parameters to determine the specific animation to play for an action.It can be difficult to remember what a numeric parameter is supposed to represent, so we'll pre-define a few blocks of numbers for our MoveSetID parameter:
For the animation sets that we'll be setting up in this tutorial, I have chosen the following MoveSetID values:
This leaves us with plenty of unused values within each block of numbers so that we can extend our game with additional animation sets without having a jumbled mess of ID values. If you think that you need more than 10 for each broad category, then I would suggest using three-digit values (so 100-199 for One-Handed Melee, etc).
Mixamo doesn't have a set of sword-only animations, so we'll need to use the Pro Sword and Shield Pack regardless of whether or not the character has a shield equipped.
Action Parameters
We'll be using Trigger parameters to play the animations for specific actions. Add the following Trigger parameters to your animator controller:Sub-State Machines
The animator states for each weapon type will be contained within its own sub-state machine (SSM) on each animator layer. The SSM names that I will be using are:Here's a secret... we're only ever going to start animations by their state names with Idle, Walk, and Run so technically it doesn't matter what you name the SSMs other than the Base Layer. But let's keep thing consistent and organized!
The next post will cover setting up your first set of weapon type animations.
Part 2: Battle Mode Animations (Basic) - Sword (and Shield) Animations
Set Up Movement
Now is the time to set the animation import settings on your idle, walk, and run animations for the Pro Sword and Shield Pack and assign them to the appropriate animator states. Refer to Part 1 for explanations of the Root Transform baking settings.For some unknown reason, the neutral idle animation is in the sword and shield idle (4) file, so make sure that you use that one in your SwordShield.Idle state.
If you rename the animation clips from "mixamo.com" to "Idle," "Walk," and "Run" then you can just drag the animation clips onto the canvas without having to rename the state afterwards.
On the Base Layer of your animator controller, create a new SSM named SwordShield. Double-click on the SSM to open it, and then drag your Sword & Shield Idle, Walk, and Run animations to the canvas (we're not using a Blend Tree this time). Create Idle first so that it is the StateMachine Default State.
This shouldn't make any difference, as nothing will ever start the state machine on its own, but it's a good practice. If you need to reassign the default state, right-click on the Entry node and select Set StateMachine Default State. Make sure you don't set it as the Default Layer State; that should always be Unarmed.Idle.
Set Up Combat Actions
First, we'll need to set the animation import settings on the clips that we will need. You can rename the "mixamo.com" clip to anything you want for these, as we're using triggers to start the animations and not the state names. I like to use more descriptive names than "Attack 1," "Attack 2", etc.For the Attack animation, we'll use the forward slash animation in sword and shield slash:
For the Cast animation, we'll use the left-hand casting animation in sword and shield casting (2):
For the Damage animation, we'll use the hit-from-front reaction in sword and shield impact (3):
For the Death animation, we'll use the die-and-fall-backward animation in sword and shield death:
For the Defend animation, we'll need to string together three animation clips: the start blocking clip
in sword and shield block, the end blocking clip in sword and shield block (2), and the block idle clip in sword and shield block idle:
Switch to the Full Body animator layer and create a new SSM named SwordShield.
Drag the Attack, Cast, Damage, and Death animations into the SwordShield SSM (still on the FullBody layer). Because the Defend action is a bit more complex, we'll create a "Defend" SSM to hold its states (go ahead and create that now).
When all of the transitions are hooked up, my SwordShield SSM looks like this:
Now, we'll create the transitions into these states.
Right-click on the Any State node and Make Transition to the Attack state ("Forward Slash" in my screenshot). Use these transition settings:
Unchecking "Can Transition to Self" prevents another transition into the state while it is currently running. We want that for all of these.
Repeat this for the Cast, Damage, and Death animation states as well, but set the appropriate trigger parameter for each. Here's a great shortcut that was added a little while back: if you right-click on a transition in the "Transitions" list in the inspector ("AnyState -> Forward Slash" in my screenshot), you can select Copy Transition Parameters; when you create a new transition to another state, you can right-click on it in the inspector and then paste the settings, the conditions, or both! I was very, very happy to discover this. Node that pasting the settings DOES NOT paste Can Transition To Self (or Interruption Source), so that has to be set manually.
When the Attack, Cast, and Damage states finish playing, we want to transition back to the root Empty node outside of the SwordShield SSM so that the Full Body layer is only active while animating a discrete action. Once the character should go back to an idle or movement state, the Base Layer takes over.
Create a new transition from the Attack state to the orange (Up) Full Body node and select States -> Empty. Use the following transition parameters:
When Has Exit Time is checked, the state will play until the animation is finished. These animations all return to the base idle animation when complete, so we'll use Exit Time 0.9 (normalized time where 0 = the first frame of the clip and 1 = the last frame) with a brief Transition Duration of 0.1s. We don't need any conditions for these; they simply exit when finished playing.
Repeat to add exit transitions from the Cast and Damage states to the root Empty state.
Note that you don't want a transition out of the Death state, as when that animation has finished, you want the character to stay in that pose from the last frame.
Open up the Defend SSM and drag the three Block animations into it. When the transitions are hooked up, mine looks like this:
Right-click on the Any State node and Make Transition to the Block Start state:
Then add a transition from Block Start to Block Idle. Ensure that this has "Use Exit Time" checked:
Add a transition from Block Idle to Block End. Playing the whole sequence of the three states is perhaps a bit long, so we'll set the Exit Time to 0.5 -- this is normalized state time, so that means halfway through the clip:
Finally, we need to transition from Block End back to the Empty state outside of the SwordShield SSM:
The Use Animation
Before we finish with the animator setup, we still need to add an animation for the Use action. For this basic tutorial, we're just going to set up the "Drinking" animation that we downloaded and hope that nobody ever uses an item other than a potion. :-)Start with the animation import settings on the clip within the ybot@Drinking file. You'll note that the character is in a neutral idle stance and not the battle-ready idle stance used by the Sword and Shield animations. It will look a bit odd transitioning from the battle-ready idle to a neutral stance and back to the battle-ready stance, but we work with what we have:
Because this animation isn't specific to the Sword and Shield animations, we'll go back to the top level of the Full Body layer and create an Unarmed SSM. Drag the Drinking animation clip into the Unarmed SSM.
If you play the Drinking animation, you can see that it doesn't so much represent a warrior frantically drinking a potion on the field of battle, but somebody taking a drink while socializing at a party. It's slow, and the character starts and ends holding his drink at around his midsection. No worries; we can work with this by setting a Transition Offset when we start the animation and by tweaking the Exit Time when we end it.
While we will add an entry transition from Any State and and exit transition back to the Empty state, those don't make it easy to test how the transition will look in the animation preview. So grab the Idle animation from the Male Locomotion Pack and drop it onto the canvas. Add a transition from Idle to Drinking, and from Drinking back to Idle. You can delete this Idle state once you've determined the transition settings that you want, but to ensure that it doesn't mess with anything if you go run the game, mute both of these transitions:
We want to find a Transition Offset time that looks good, so select the Idle -> Drinking transition. We're going to be playing this transition many times until we find a good offset value and the Idle animation is long, so set the Exit Time to 0.2 so that we don't get frustrated watching him just stand there:
We also need to have him take a drink with a little more urgency. Bump the playback speed in the animation preview up to 1.5 and play the part of the animation where he actually takes a drink. Okay, that looks better.
Move the play head of the preview window to the point in the Drinking animation where he just starts to raise his hand. You can see the white vertical line moving through the transition timeline as you move the play head. Then click on the "Drinking" clip in the transition timeline, right on the line (colored red in the image). Drag it left until your mouse pointer is within the blue shaded area that represents the transition duration:
You can click on the clip anywhere to drag it, but this way you're not just guessing and moving the clip back and forth in the transition timeline until you get it right. You may still need to tweak it a bit once you play the whole transition, but it should be pretty close.
A Transition Offset around 0.24 looks pretty good.
Next we need to find a good Exit Time. Select the Drinking -> Idle transition and move the play head to where he just finishes lowering his hand:
Now you can just grab the Idle state in the transition timeline and move it until its left edge is touching the white line:
I didn't do it here, but sometimes this process is easier (for both the entry and exit transitions) if you zero out the Transition Duration so that you can pinpoint the exact spot in the animation where you want to enter or exit, and then increase the duration until it looks smooth.
An Exit Time of around 0.65 looks good.
Add the transition from Any State to Drinking, with the Use Trigger parameter:
And the transition from Drinking back to the Empty node outside of the SSM:
Before we forget, we also want to change the playback speed of the Drinking animation, as we only changed the speed of the animation preview. Select the Drinking state and change its speed to 1.5:
You can also drag the Sword and Shield Idle onto the canvas and copy your transition settings so that you can see how those transitions look. As I said, it's a bit awkward how the stance changes, but there isn't much we can do about that here. The same settings look good enough. If you found that you wanted to change the Transition Offset or Exit Time, then you would just create additional transitions to or from the Drinking state, but also add MoveSetID = 12 to the condition(s).
4. ORK Setup
As the Drinking animation that we set up for the "Use" action is not specific to any one weapon animation set, add a "Use" animation type to your Default Humanoid animations settings:Create a new Animations setting for the Pro Sword and Shield Pack animations:
Set up the Idle, Walk, and Run animations the same way that you did in Part 1 (but ensure they use the "SwordShield" SSM name):
Now we will add animations for animation types that represent discrete actions. All of these will use Play Mode: None, do not need a State Name or Layer Index specified, and will require (at least) two Play parameters: a Trigger and an Int parameter named MoveSetID with a value of 12.
Add a "Damage" animation type, using the Trigger parameter Damaged. Also set the Duration to 0.7s:
When you play a Mecanim animation with the Play Combatant Animation node in an ORK Event, the "Wait" setting doesn't work unless you have specified a Duration in the animation setting here. For the Damage animation, I just specify the length of the animation clip that we're using.
Add a "Death" animation type with the Trigger parameter Die. The animation clip has a duration of 2.3s.
Add an "Attack" animation type with the Trigger parameter Attack -- but this time we don't want the Duration to be the length of the animation clip. Normally, you're going to want to time the hit or miss sound and visual effects with the point where the attack would make contact with its target. If we use the full length of the clip, then when we Wait for the attack animation to finish, those effects will all be added after the attacker goes back into an idle pose, which looks kind of sloppy.
You'll need to find the timestamp within the animation clip where the attack would make contact. Most likely, you'll want this slightly before, to allow frame or two for the effects to be created or loaded. Select your attack animation clip in the Project view and manually move the position indicator in the preview window to the point of contact and then move it left about one frame back. This isn't an exact science and it will require some trial and error. I chose a point at 40% of the way through the 1.5 second clip, so that gives us a Duration of 0.6s -- all it really means is how long we want a Play Combatant Animation node to wait before proceeding to the next node.
If we specify the duration here, then we don't need to add a Wait 1s node in our Attack Battle Event, so the timing can easily match each weapon type's attack animations quite closely.
Add a "Cast" animation type with the Trigger parameter Cast:
As with the "Attack" type, we're using the timestamp in the casting animation where the spell effects should be spawned as our Duration:
Finally, add a "Defend" animation type with the Trigger parameter Defend and a Duration of 1.9s. Because we set the Exit Time of the Block Idle state to 0.5, I added the clip lengths of the Block Start and Block End to one-half of the Block Idle clip's length.
Please let me know if you come across any errors, stuff that I've missed, incorrect screenshots, etc.... This is a long and rather complex tutorial, so it's easy to make mistakes.
And of course, feel free to ask questions or let me know if I didn't explain something very clearly.
I don't understand one thing. The system seems to change MoveSetID value based on type of weapon used, however I don't understand how that works.It looks I can just make an equip event that changes MoveSetID value, however I need to reequip weapon during combat for this to work, an weapon equipped before combat doesn't set MoveSetID.
The same problem applies to femininity.
I don't understand what triggers weapon idle/walk/ run states.
I also have a problem with enemies changing orientation after playing death animation.
I.e. set up the animations that should be changed in Base/Control > Animations as a new animation setup. In the weapon's settings (Inventory > Weapons) enable using Own Animations (if it's only for battles, enable the Battle one) and select the animation setup that should be used.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The Combatants should have "Use Auto Animation" enabled under Automatic Move Animation (at the very end of Part 1, above). When using auto move animations, ORK will play the Idle/Walk/Run animations depending on the combatant's movement speed. In the animation setup above, we're using Animator.CrossFade() to play them by specifying the state name on the animator.
For the other types of animation, we're activating them on the animator controller by setting a Trigger parameter in conjunction with an int MoveSetID parameter. These animation settings are near the end of Part 2, above.
If you're using a different animator controller for each character, you can just set the Femininity parameter directly on the animator controller (I don't recommend this, as you don't really need a separate controller for each character). I would probably set it as a float object variable on each Combatant, and then write up a simple component that gets that float variable value and sets the Femininity parameter on the animator. If you have a NavMeshAgent on the enemies, make sure that you disable it when the combatant dies.