How to sprint only forward!?

Hi, I want to know how to make my character sprints only forward. The problem now is when I use sprint it will sprint left, right and back. Here is my bluprint:

Hmm…just to learn a bit more about your goals:

Is the character intended to always be sprinting if they are moving forward? Or is there a “normal speed” option and then they press a button to sprint (but only forward and not other directions)?

you see what you are doing on w being pressed? do that on input action sprint too, but also, set a bool that overrides what i assume you have for ‘left pressed’ ‘right pressed’ ‘back pressed’ ‘forwards pressed’ etc.

use branch node to avoid doing the settings when this value is true, and lets call it bIsSprinting

then enable bIsSprinting on pressed, and disable it on released, as well as doing the ‘forward pressed’ changes that the w key handler is already doing

Thanks for the replies guys, I found the solution for it and it’s exactly what I want it to do. Here’s the blueprint for those who are finding the solution as well.

2 Likes

Hey!

I know it’s to late, but I had the same question and I just find a solution!

No strange bool, just an AND that detected if The command for sprinting (Pressed = Is A) and the walk forward (Axis >= 1) are pressed in the same time.

2 Likes

I know this is an old post but an easy way to handle this is to simply set a variable, lets call it ‘Y Direction’, from your forward/backward input, then check if its greater than 0 when the player attempts to sprint.

1 Like