Mathf.Lerp on Animation Clip Speed not working

Hi, I’m having a problem lerping an animation speed, here’s what I’ve tried.

rrh.transform.position = Vector3.Lerp (originalPos, Vector3(-1.5,0.6,-1.2) ,Time.deltaTime / smooth);
ridingHood.go.animation.Play(anim);
ridingHood.go.animation[anim].wrapMode = WrapMode.Loop;
ridingHood.go.animation[anim].speed = Mathf.Lerp(1.0,0.0,Time.deltaTime / 4.0);

I’m moving my character with a Vector3.Lerp and obviously I want the walk cycle speed to slow with the movement. Is this the best way of going about things? and why isnt the Mathf.Lerp effecting the speed of the animation?

Any suggestions? Thanks - Caius

This will return a constant value depending on your framerate:

Mathf.Lerp(1.0,0.0,Time.deltaTime / 4.0);

Example: at 100 fps deltaTime is (1.0 / 100) == 0.01 You divide it by 4 → (0.01 / 4) == 0.0025

Lerp is a linear interpolation. The “t” value goes from 0.0 to 1.0
0.0 means start (from)
1.0 means end (to)

All lerp does is:

return ((1.0f-t)*from+ (t)*to);

Since your Start value is 1.0 the returned value will be always 0,9975

If you want to use Lerp as a “smoothing”-function you have to use the current value as start, otherwise it won’t change over time.