Working with default max walk speed, don't understand result

So I set up a smooth crouch thing which works fine. There’s just one thing I don’t understand and I hope one of you can point it out to me.

The part of the script I show screenshots of is where the Max Walk Speed is set. It is lerped between Max Crouch Speed and another variable.

This other variable is what I don’t understand - I have to set it up in “Event Begin Play” and set it to “Max Walk Speed” from the Movement Component, and then use this Variable (Real Move Speed) for the lerp.

Why does it not work if I put the “Max Walk Speed” from the Movement Component directly in the lerp?

They have to be both the same.

Is it because if I set the “Real Move Speed” to what “Max Walk Speed” is in the beginning of the game, the “Real Move Speed” will all the time stay at the same (lets say 100), so 100 will be used for the lerp, while if I put “Max Walk Speed” in the lerp, it will change to a lower value when crouching and then this will be used in the lerp? Because I stay slow after crouching if I put the “Max Walk Speed” in there.

Think about what you do there:

You take Max Speed and lerp it than Set the lerped Value to be the new Max Speed Value. In the next iteration of Lerp you take the Max Speed (a different Value now!) and repeat…

If you use another Variable instead you never modify it with the lerp it stays consisten all the time.

Simple as that =)

Ok so I guess I was guessing right :wink:

I didn’t get it because I thought max speed and the other variable are the same, but you’re right, the other variable does not get changed. Sometimes got trouble to wrap my head around all of this :smiley:

Also does lerp mean it is a value between the 2 variables, or it switches between the 2 variables values?

Danke!