top of page

Adding a Sprint Animation and System to a Basic Third Person Character in Unreal Engine

Updated: Aug 12

Creating a New Input Action

  • Picking up from where we left off in the previous tutorials centering around the Basic Third Person Character Animations and Locomotion system, we are going to head to our Content > Third Person > Input > Actions folder and right click then create a new Input Action under the Input dropdown. We can name this "IA_Sprint". Now head back to the input folder and open IMC_Default. We are going to add a mapping and assign the IA_Sprint, for this we bind this to the L-Shift key.

ree

Adding a Sprint Ability to our Blueprint

  • Let's head over to our Third Person Character Blueprint and in the Event Graph we can right click and search for our new input action "IA Sprint". From the Triggered execution we want to create a branch, and from our branch we can copy and paste our set character movement from before then change the amount to 500. After that we can create a new Boolean variable and name it "Is Sprinting?" to keep track of whether or not the character is actively sprinting, then set that variable to true after our character movement speed adjustment. Let's also get our "Is Running?" and "Is Walking?" Booleans and set them to false after "Is Sprinting?".


  • The reason we are creating a branch is so that we can set conditions for when our character is allowed to sprint. For example, we do not want to allow our player to be able to sprint when they are in the air and we also do not want our player to be able to sprint if we are crouched. In our previous tutorials we covered crouching and jumping so we should have a good idea of where to find that information.


  • We can start with getting our "Is Crouching?" variable and then dragging off a NOT Boolean from it. Then we can get our character movement component and get "Is Falling", then from that create another NOT Boolean. The last thing we want to set for our sprint condition right now is to check if the player is moving in a forward direction, we want to do this because our character should only be able to sprint in a forward direction, but to do this we need to create a function.


  • Click the (+) icon next to the Functions section and we are going to name this function "Check forward Direction". This function will heavily resemble a portion of our Animation Blueprint. Right click and search for "Get Velocity" then right click again and find "Get Actor Rotation". From either of the two node you can drag from the return and find the "Calculate Direction" node, then connect the two values into the inputs. From the Calculate Direction return we want to search for "In Range (Float). We are going to set our minimum value as -30 and our Maximum Value as 30. What this node does is it checks to see if the value it is presented is within the set range and then it returns a true or false value based on the values. So, let's drag from our execute for our function and create a return node, then in the details set it as a pure function. Now drag the value from the In Range node into the Return Node.

ree
  • Let's drag in our new function then from any of the three conditions so far we can get a AND Boolean, then place all three as conditions. Now take that AND Boolean and set it as the condition of the branch. So, what we should have right now is that to allow our character to Sprint when the Input Action (L-Shift) is pressed we cannot be Crouching or Falling, and we must be moving in a Direction that is roughly forwards. If we are not doing all three of those things then we will sprint, but if we are not, we still need to define the false string of the branch.


  • What we are going to do is highlight and copy our true branch and then make some slight adjustments. Let's change our Set Max Walk Speed to 375 since that is our running speed, then let's set sprinting and walking as false, and running as true. What we also want to do is give our character a small buffer window if they are to stop running, so let's create another Boolean Variable and call it "Can Sprint" let's sit it to false after our duplicated string, then from it get a Retriggerable Delay node and set it to 0.3 then from that lets set our "Can Sprint" as true. To finish this off we can drag from our Canceled and Completed executes and set it to out false string from our branch.


  • Highlight our work and then comment. Name it Sprint Action.

ree

Updating our Animation Blueprint to add Sprinting

  • Now that we have created our Blueprint to allow our character to sprint, we want to update our animation blueprint to visually represent that. So head over to Content > Animations > Synty > AB_Synty and look for our Animation Blueprint. Open it up and head to the Locomotion State Machine. Here we want to create a new state coming from our Locomotion state and we can name it Sprinting. Inside we want to get our "A_Sprint_F_Masc" animation from our asset browser and set that as our output pose. Once the output pose is set then backtrack to the Locomotion state machine graph and make sure we have a transition going to and from Sprinting and Locomotion. The only thing we are missing is a local variable that communicates when our character is sprinting.

ree
  • In our Animation Blueprint switch to our Event Graph, and find space to the right of our "Check if Crouching" and "Check if Falling". We are going to use another property access to retrieve our "Is Sprinting?" variable from our Third Person Character Blueprint. So right click and search for property access then find our Third Person Character then "Is Sprinting?". Let's promote this result and place it after our Check if Falling.

ree
  • Now that we have our variable, lets head back to our state machine and set up our transitions. For our transition from Locomotion to Sprinting we want to get our "Is Sprinting?" Boolean and set that as the condition. For our transition from Sprinting to Locomotion we want to get our "Is Sprinting?" Boolean as well but this time we can get a NOT Boolean from it and set that as our transition condition.


  • Don't forget to save and compile!


If you would like to follow the Step-by-Step Tutorial, Check out the Video Below!

Comments


© 2025 by Crow's Keep Studios Powered and secured by Wix

bottom of page