Download

(help) I need to prevent sprinting action when going in certain direction !!!

Hi guys ,

So my project is coming along but now im facing a problem that i imagine to be probably simple to fix for some of you.

So right now when i press ’ left shift ’ i can sprint in any direction. But for my concept i really need to fix it so i can only sprint forward and sideways and when im going back i want the character to only be able to walk at normal speed.

i would also like to change the hold shift to sprint i would prefer it to be pressed once and you can sprint press again and you walk. :confused:

So if someone would have an idea or BP example I would really appriciate it !!!

Thanks !

Bump, please guys lolll just a heads up to put me on the right track would be good lol

Ok so I’m not at my computer right now, so I apologize for the mes and this seems a little hacky but it SHOULD work.

For the purposes of this graphic, I am assuming your character sprint speed is twice the speed of your normal movement, hence dividing the new forward axis value by 2 when the character’s forward axis value is negative (So he’s travelling backwards)

You need to make 3 variables

Float: NewForwardAxisValue Default: 0.0
Float: NewSideAxisValue Default: 0.0
Boolean: IsSprinting? Default: False

Then follow this horribly messy graph. (leave all the actor forward vector stuff that is already there plugged into the AddMovementInput nodes.

Ill check back when I’m home to see if you understood my terrible drawing :stuck_out_tongue:

Let me know if it works.

thank you so much !!

i do understand the graph loll ill try that as soon as i can and let you know if everything work !! your a beast for taking the time to draw this !!