I’m simply trying to add sprinting to my character. I’ve already set up a “sprint” input event in my project settings and I’ve added an “isSprinting” bool to my character BP. I figured I could simply add a multiplier to the axis value that the move forward got based on if the isSprinting bool was set or not, but this doesn’t work. What do I need to do here? Seems like this should be a simple quick fix, but it’s hard to make a search term that brings up any useful information related to this.
Are you using a character with a charactermovement component? That component has a ‘max walk speed’ variable which you can edit. Do something like when the sprint button is held down, increase the max walk speed on the charactermovement component. When the sprint button is released, set the maxmovespeed back to whatever your default walk speed is.
Increasing the scale value won’t do anything as it only goes from -1.0 to 1.0 I believe (it’s a multiplier such that say a value of 0.5 will go half the max walk speed, you can’t go higher than 1 though as that is 100% of the max walk speed).
Edit: scale is from -1.0 to 1.0, not 0-1 unless i’m mistaken
He isnt actually manipulating the scale value, hes using it to modify another value so it should work. But i think youre right. Its probably the max speed stopping him from going any faster.
You probably want your bIsSprinting bool to change the max speed cap instead of modifying the forward axis input (since it actually applies acceleration, not speed, if im understanding the code correctly).
Well the value he’s setting is being plugged directly into the movement input’s scale which is what i meant by trying to increase the scale. I don’t think he can increase it beyond 1.0 (which is max acceleration?), or lower than -1.0
Got back to it this morning. Yep. This works perfectly. (Will be changing the literals into variables for easy modification during game play, but if anyone else wants a simple, easy way to do this, here it is.)