Variables not updating with user input

I’m trying to have the speed of my character change with an accelerator button (‘W’ on the keyboard). This worked earlier today, but, according to the debugger, the speed is no longer updating. Here is my blue print for the updating:

modulate speed

Here is the auto-walk that is supposed to be modulated by the updating speed:

And here is the beginplay event, which sets the speed and accelerator:

beginplay

During play, the speed stays constant no matter what I do! Any advice? Thanks!

This blueprint is for the playercharacter by the way

Looking at the first picture, I see that the “Speed Adder” variable has a value of zero, so no speed is being added there… I don’t know if that’s during simulation, though.

Also, you are setting “Speed Adder” and “Speed” immediately at BeingPlay. Have you considered setting those values as the Default Value? To do so, select your variable from under “My Blueprint” → “Variables” and change the Default Value from the Details panel. That’s the proper way to set a variable’s initial value, but maybe you have a good reason.

That’s just what I noticed, don’t know if it’ll help.

2 Likes

Thanks for your reply… I just tried this with default values (0.01 and 0.01), and it looks like they’re not being added correctly:

Do you know why this might be going on or any ways I could solve?

Honestly, no. :confused:

I haven’t seen anything like that, but yeah, it seems the addition isn’t working.

1 Like

I haven’t seen it done this way… I think if you have added your input action (w) being pressed with a value of 1 you can assume forward speed at that value. and -1 being the opposite direction. Or 0 to be neutral value.

You may need to feed the axis value into your speed otherwise it doesn’t know whether your value is 1 or 0 or -1 so essentially nothing is changing…

So if you wanted to move forward with “W” than the values in your input action should be between 1 and 0 and if you wanted to use “A” to move backwards it’s value being 0 and -1. But the axis value needs to be the input?

1 Like

I did it this way. It seems to work! Thank you

1 Like

No worries, got it figured out. Thank you for your replies!

1 Like