Download

Set sprinting variable

Hi, I followed the FPS tutorial here: https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial

After doing so, I wanted to implement sprinting. I made this by adding 2 new input handler things and creating the two voids for key press and key release, then doing in key press:
GetCharacterMovement()->MaxWalkSpeed = 1800.f;

Then when the SHIFT key is released, set it back to 600.f (the default max walk speed).

This is all good, except I needed to have a sprint animation run instead of the default run animation.
I duplicated the FPP_Run animation given by the tutorial and called it FPP_Sprint then made the speed a bit faster.

Now I have to actually play the animation if they are sprinting.

Here is my blueprint currently:


As you can see, I created isSprinting variable.

I also had to add the Sprinting state:

But how do I instead of setting isRunning true if the velocity is greater than 0, set isSprinting to true if the velocity is greater than 0 and the max walk speed is greater than 1000 (roughly), if not true for either/both of those statements, set isRunning to true if the velocity is greater than 0.

Never mind, I figured it out.

Here’s how, if for someone reason someone else wants to know: