Following the tutorial on character animations, I was able to learn about how to set-up the animation for the Walk/Run transition.
Firstly, I have created an Animation Blueprint file using the Mixamo character Adam as the skeletal mesh option.
I have attached a State Machine node to the Final Animation Pose. This will enable us to set-up several animations and play one depending on the state it is currently in.
By double-clicking on the state machine, we can go inside and set-up the animations.
By setting up Entry > Idle > Walk_Run
Idle < Walk_Run
This means we can go from Entry to Idle animation to the Walk_Run. If we do not set up a link from Walk_Run back to Idle, it means we will be stuck on the running animation, unable to switch back to the previous state.
By double-clicking on the Idle and Walk_Run, we can go inside the file and assign the correct animation to play.
Simply by dragging and dropping in the animation and linking it up to the Final Animation Pose, this assigns the animation to that state.
The next step I took was to create a Blendspace, selecting Mixamo Adam's skeletal mesh for this as well.
Inside the Blendspace is a window to assign animations on a graph. On the left panel, I have set-up the Axis settings. The horizontal is the Direction, and the vertical is the Speed.
Horizontal - Minimum axis = -180.
- Maximum axis = 180.
Vertical - Minimum Speed = 100.
Vertical - Maximum Speed = 600.
The reason the horizontal axis values are that is so we can rotate a full 360 degrees.
For the vertical, the minimum 100 is the default, and the maximum walk speed I set-up in the stamina/sprinting section within the First Person Character blueprint file was 600.
By adding the interpolation time to 1, this means our animations will not instantly switch from one to another. It switches between the animations over a one second period, resulting in a smooth and realistic effect. In play mode and interpolation time set to 0, you notice the unnatural change between animations and can identify the animation switches.
By simply dragging and dropping the animations from the browser onto the graph, we can set up the animations for the correct direction and speed. By selecting the top-left middle button, it allows us to see the names of the animations which makes it easier to ensure you have selected the correct animations.
Where you drag the green diamond is where the preview will view. Holding Shift and dragging the mouse around will result in the green diamond being dragged where ever the mouse is, meaning we can see the preview update as we move it around for testing purposes.
In the Blueprint file, I have selected the Walk_Run state rather than the Idle. Inside I have linked up the Blendspace file that was just created. The node has links for Direction and Speed, rather than inputting a value manually, I have created and linked variables named Direction and Speed to the Walk_RunBS node.
By doing this we are calculating the speed and direction of the character. In the tutorial, he has used VectorLengthSquared, whereas I have used VectorLength. The reason being that I found this was an error, and this will end up with a far larger speed by squaring it. Instead, we get the accurate values using VectorLength.
The final step is to instruct when to call the animations. By clicking on these icons, we can determine when the corresponding animation should be activated.
This part is very simple for the Walk_Run animation. All we are doing is checking whether the speed is more than or less than 10. By checking the value of our speed variable, we can determine whether our player is moving or not. The Blendspace we set-up previous handles the rest of the animations based on speed/direction.
Overall, I think setting up the animations is a simple concept - especially with using the Blendspace. I think there could be some situations where you are dealing with a large number of animations it could get very cluttered, especially in the blueprints and be quite difficult to keep track of your work.
After learning a range of aspects of animation from the tutorial, I feel confident to go ahead and create basic animations for my character, which I intend to do with the time after the foundations of my game are complete. I would like to complete jump, death, hit reaction, and potentially crouch/prone animations.














No comments:
Post a Comment