Creating Character Animations in Timeline and Tackling Some Known Issues
Objective: To learn how to setup character animations in Timeline, whilst solving a few known issues.
Now that we have imported and setup our characters and their animations from Mixamo into Unity, it is time to build our character animation sequence in Timeline!
Create a Timeline and Animation Track
As we are creating this through Timeline, we need to make sure that we have a game object that is going to control our PlaybackDirector() component.
Right click in Hierarchy → Create Empty Game Object → Reset position in Inspector → Rename to ‘CharacterDirector’ → Create new Timeline → Drag both models into the Timeline window and create 2 new Animation Tracks.
Note: If you are unsure how to setup Timeline or Animation Tracks, see these articles.
Your Timeline window should look like this now:
Adding Animations to the Timeline Sequence
Let’s get this setup just for one character first and then you can have fun with the second one. Drag and drop your animations into the Timeline window:
Note: If you want to be able to rename your animations from ‘mixamo.com’ you will need to duplicate the file and rename the duplicated one, however, you might lose the preview model:
Blending our Animations
As you saw above we now have a complete animation sequence full of different character animations. Now it is time to blend them together to make it look more fluid and natural.
Right now we start with a hurricane kick that moves the character forward and when it finishes it resets back to the starting point where the next animation plays.
I think this is a fantastic opportunity to first use the ‘Match Offsets to Previous Clip’ feature:
So what this essentially means is, wherever the characters position is at the end of the first clip, will be the start of the next clip. Instead of resetting back to it’s original position:
Next, we want to blend this two together so it doesn’t look so jerky and more fluid/natural looking. This is very simple! And it is just going to be dragging the second animation clip on top of the first animation clip:
Now we are left with this:
Here I have now added a couple more animations and have got them all blended into each other and it has completed our animation:
There is still some small blend tweaks to be made to get this working perfectly!
These come in all shapes and sizes and luckily I have run into some so I can help you out here. The first animation snaps back to it’s original starting point, where animation 2 starts from. Also, animation 4 has just decided to be stuck in the middle of the ground. So let’s take a look at possible solutions for them.
Help My Character is Moving Off the Screen and I want Them to Stay Still
Case in point. There are a few possible solutions to this, see which one works.
Solution 1 —Is to set the movement value of the animation to 0 in Mixamo before downloading.
Solution 2 — It could be a root motion issue. Try toggling this on and off and see if this resolves the issue. Root Motion is where an entire game objects mesh moves away from it’s starting point. And this is generally caused by the animation itself instead of the actual transform position.
Solution 3 — Root Transform Position needs to be ‘Baked into Pose’. For our particular issue we would be looking at both the Y and XZ. This will help the character stop from being raised on the Y axis and moving along the XZ axis.
Solution 4 — The long way. Duplicating the animation and going into the Animation tab to locate the transform’s position being moved and delete the keyframes:
Help My Character Model is Folding Itself in Weird Directions When Playing an Animation OR it is Stuck in the Middle of the Ground
The highest possible cause of this is that your character model is set to Humanoid but your animation is set to ‘Generic’. Changing this over should resolve the issue.
I have also had instances of this where I have duplicated an animation from Mixamo and it has caused this issue, so I wasn’t able to use a duplicated copy. See how you go and good luck =)