
Before putting a character into unity, there needs to be a character model. Though it would be possible to build one in Blender from scratch, the process would be very time consuming. So instead I’ve opted to download a pre-rigged character model to save time. I may come back and change the model at a later date, but in the meantime a pre-made character model will do.
This is the character model I’ve decided to use in the meantime. It is a useful model as it is already rigged and has a walking animation, running animation and an idle animation.
Because of this it will be very easy to implement into the game, it could also be used as a reference or base for when I create my own model.
After changing some values, like size and position, the model has the scripts from the player object applied to it and is put in place of the player prefab. The model is now in place of the red square. After changing some collision settings and stuff to fit this new model, it works. However, the model has no animation, so is rather motionless. To fix this we need to create an animator controller. Because This model has a walking and running animation I want to create a run button and a variable that changes the animation depending on the speed of the player. After some changes to the script, it’s time to incorporate the animations.

A new input to the game is added and the animation window is opened. I create a blend tree, which is essentially how Unity transitions from one animation to another, to make gameplay appear fluid. Because there are 3 animations that need transitions between them (idle, walk and run), there needs to be 3 motion fields.
After some more debugging and changes to the player physics and controller, we can see that the player animations now depend on the variable, that is the speed of the player. When the player isn’t moving (speed=0) the player is in the idle position. As the player picks up speed (speed=8) the walking animation begins. When shift is held (Speed=12) the run animation begins. Because of the blend tree, this all looks nice and fluid.