Sprinting while holding shift

Hi guys! So basically right now I’m trying to implement the “hold shift to run” mechanic in my project and I’m struggling a bit with it so I hope you guys can help me out. Basically I already have this in my ABP

Just ignore the jump for now
And I’m also setting up the variables that define when my character would be jumping or running and such like so

Now my plan would be to make a new variable that would trigger the run animation inside the ABP, but currently I’m not being able to do that.
Also should show what my bp looks like:

That input action on the right is supposed to be what would say if shift is being held or not.
I just wanted to set up the variable by setting it the same way Is In Air and Speed is set up, but I don’t quite know how to do so. I tried to just connect it like this but it would only read it as being held all the time.
Thank you for your time!

Hi BojukaBog,

Rather than make the run a separate system in your anim blueprint - it’s way easier just to make a “BlendSpace” that smoothly controls the animation between idle, walk and run depending on speed with no other logic needed.

The speed can be calculated in your anim blueprint from GetPlayerPawn->GetVelocity->VectorLength - if that’s 0.0 you’re idle, if it’s around 300.0 you’re walking and around 600.0-1000.0 you’re running.

1 Like

On the Animation Graph:
If Speed > 300 then enter Run_Loop.
If <= 300 then exit Run_Loop.

On InputAction Run: Set Max Walk Speed to 600 (or whatever).

That should work fine.

1 Like