Looking for Lerp Style of Vectors that increases over time.

Is there a command that allows me to change a Vector3 value at a speed which increases over time and vice versa?

It will start off by moving slowly towards it’s goal but will increase in speed during it’s lerp cycle. I would also like to know if there was a command that does the opposite, it will start off fast then slow down around near the end.

Thank you!

For that, you can still use Vector3.Lerp, but instead of passing the time as t, you can transform t using an animation curve as follows:

var curve = AnimationCurve.EaseInOut(0, 0, 1, 1);

// .. in your update code, coroutine, whatever
Vector3 output = Vector3.Lerp(a, b, curve.Evaluate(t));

This curve can really be anything and you can even use the curve editor to do that (make the AnimationCurve a public field for that). If you’d like a more fine grained control, you’ll have to get into some simple parabola math:

instead of the curve, you can then use tt to start with velocity zero and constant acceleration or (1-t)(1-t) to start with with a high velocity and decrease the velocity linearly (constant acceleration) to zero.

1 Like

This seems interesting! I’ll give it a shot. Do you think it can be used for crosshair sway as well? Like using it to make a cross hair drift to multiple vectors in one command.