In Discord recently there have been a few people running into some issues getting Mecanim up and running with ORK, so I thought I would throw together this quick tutorial for those that may find the one by Keldryn a bit overwhelming. I highly recommend you go back to Keldryn's tutorial once you get some more familiarity with ORK and Mecanim, as it has some good standards and organization (such as using sub-state machines).
This is a pretty straightforward and quick setup, which should get you up and running without needing to mess around too much.
Note: This is not setup for Root Motion. The example project is an extremely basic ORK setup using the built-in button controller and follow camera but without any UI, status, battle, or other setup going on. It will work with custom controllers as well (my own project uses a custom controller and camera but uses the same setup below)
1. Get Animations
If you don't already have your own humanoid animations (specifically Idle, Walk and Run for this tutorial), refer to Keldryn's guide
for Mixamo, but stop once you get to the step to create the animation controller.
2. Create the Animation Controller
For this tutorial we're just going to setup a single state using a Blend Tree, and feed in a speed parameter so Mecanim does all the heavy lifting.
Create an animation controller somewhere in your project (Right Click -> Create -> Animation Controller).
First, add your float parameter to the animation controller:
Then create a blend tree (Right Click in the Controller):
Double click the blend tree to open it up. Since we only have one float parameter, by default the Blend Tree should already be setup to be using Speed as the parameter. On the right hand side, add 3 motion fields:
Add your animations from step 1 in the order of Idle, Walk and Run. Additionally, uncheck automate threshold and modify them to roughly the speed you will want them to correspond with:
Finally, add the animation controller to the animation component on your combatant prefab (in Unity itself). That's it!
3. Setup animations in ORK
Because we're not relying on ORK to need to know anything about the idle/walk/run animations, this is pretty quick. All we need to do is set a Horizontal auto parameter which ORK will pass back to Mecanim in an Update loop, letting Mecanim take care of the animations and blending.
4. Set Combatant General Settings
We're setting this at the general level, but you can also do this on a combatant by combatant basis (especially useful if you are using different animators and animations for them).
This one is also pretty quick, just click to Add Animations under Default Animations selecting the ORK animation from step 3, and ensure Use Position Change is checked under Default Move Speed.
Running around you should now have your character animated with a basic idle/walk/run blend tree with Mecanim:
If your animations aren't playing, and you're using an ORK Game Starter component, ensure that Start Game is checked. If not, the game isn't actually running and ORK will not
pass in your movement speed parameter to Mecanim.
Tutorial project: Here
***DOES NOT INCLUDE ORK
*** - You must
download and import your own copy of ORK into the project to run this sample. This link only contains a Unity Project with a sample scene, mixamo animation and character, and the corresponding ORK settings. I do not recommend trying to import this package into your existing ORK project as data may be erased. This is best for using as a brand new project to reference.