Walk when gamepad stick is tilted slightly and run when tilted fully

Hi everyone,

I was looking at the third person template project and I wanted to make the character accelerate to running using the gamepad instead of any kind of left stick input causing the character to immediately run. I found the “MaxAcceleration” property of the CharacterMovement component and this almost achieved what I was looking for, but a slight left stick movement will only add up the accelerations (from the AddMovementInput BP node) until the maximum speed is reached (configured on the component as well.)

I’m wondering if there is a way to somehow have the character have a dynamic maximum speed based on the gamepad stick, or something like that, to achieve a walking effect when the gamepad left stick is slightly tilted, and a running effect when the gamepad left stick is fully tilted.

Thanks!

-Phil

I don’t have UE4 in front of me but there should be a way to get the sticks input value and multiply it times your speed variable. The input probably returns a value between -1.0 and 1.0 on the x and y axis.

Hi Phil,

I submitted official support for proper analog movement to the source a couple days ago. It should be in the next release.

Essentially the code should not have normalized the input vector, because doing so dropped the analog info. Then we also needed to scale the max speed based on the analog value (basically the length of the input vector, capped at 1.0).

As a workaround you might be able to scale the maximum speed based on the analog value * default max speed.

That’s what I do and it works very good!

Edit: Although I do via C++ and not with BP