How to slowly interpolate axis input value back to 0 when gamepad thumbstick is released?

I’ve setup a custom axis mapping on the Gamepad Left Thumbstick X-Axis and now I’m stuck trying to figure out how to make the value slowly return back to zero when the player releases the thumbstick. Right now, the thumbstick axis input returns a value between [-1, 1] and my movement is perfectly correlated with that value. However, for multiple gameplay reasons (camera control, moving cursor with gamepad, etc), I don’t want the input values going into those components to just immediately jump back to 0 when the stick is released - I need them to slowly interpolate to a stop. Imagine sliding something heavy across a table - that’s the idea.

Does UE4 have any way to do this? Any suggestions are welcome. This one has me stumped.

Use a timeline. Use the axis value as the start point, set a time length for the timeline to work which slowly decreases the axis value over the length of the timeline. May need some tinkering around to get it just right but timeline should be what you’re looking for.

Hope this helps! If it does, please do me a favor and accept the answer by clicking the check mark below the arrows next to the answer (answer will highlighters.) thanks!

Sure, timelines can interpolate between values when triggered but I don’t think that’s exactly what I need here. Axis input is firing every tick and I really ONLY want the interpolation to happen when a player releases the x-axis from 1 or -1 to 0. I don’t want to modify any user input other than ‘stick release’.

I suppose I could store the x-axis input value into a variable on each tick and compare it to the previous tick’s value, then use a branch to kickoff a timeline to blend it out but that seems like an expensive way to solve the problem and I don’t like it.

Hi SVR33,

I too am looking for a solution, a better way to a timeline would be a finterp but again I can’t help but feel that there must be a better way. In Unity the axis interpolation was a built in feature it seems improbable that such option needs to be scripted in UE4.

This is how I ended up doing it.

Ok, following your comment I’m posting a snipping of the answer you have found for future reference. Thanks for the info SVR33 and thanks to Mosel3y for the answer.