- Home /

# Vector3.Lerp slow first and become faster

is there and alternative to vector3.Lerp that makes it slow at first and get faster, rather than the other way?

**Answer** by tanoshimi
·
Jan 25, 2015 at 07:06 AM

Lerp is *not* fast at first, slow later. It is linear (that's what the 'L' stands for) with the delta supplied as the third parameter.

However, it is commonly misused. You might want to read the following to explain how:

To have a smoothing function that eases in, you need to provide an appropriate function as the third parameter (some sort of exponential function, perhaps)

thanks, i'm always having trouble using lerp, i didn't realize it's like this

Please note that in the first article you linked, the author writes percentage > 1.0f. This is called a ratio.

Also, he overcomplicates the lerping mechanic.

**Answer** by jojo_game_studios
·
Jul 27, 2019 at 04:28 PM

@Lostrick I know that this is late, but you can spherically interpolate the the Vector using Vector3.Slerp. The Slerp method is more resource intensive, but it creates a smooth in and smooth out effect to both Quaternion rotations and Vector movements.

Huh? No it does not. Slerp is also a linear interpolation but for vectors and ensures a correct spherical interpolation. It does not ease in any way. Where did you get that form? Have you actually read the documentation? Slerp only makes sense for rotations or direction vectors. Slerp will ensure that the vector keeps its length while interpolating.

You may also want to read the wikipedia page on slerp:

It refers to

constant-speedmotion along a unit-radius great circle arc, given the ends and an interpolation parameter between 0 and 1.

If you want easing you can simply use one of the classic hermite spline polynomials and feed your t value through that function before using it in Lerp / Slerp.

@Bunny83 Spherically Interpolating does create an ease in/ease out effect because the Vector or Quaternion does not change equal amounts as compared to linear interpolating. Spherically interpolating changes slower at low and high percentages and faster at middle percentages.

No, it does not. You don't seem to understand what spherical means, It moves at constant angular speed. The motion represents an arc ins$$anonymous$$d of a straight line, that's the only difference between Lerp and Slerp. See this video for a visualization. Slerp will always rotate along the shortest arc.

*edit*

Try attaching this script to a sphere in your scene. It will move the object from (0,5,0) to (5,0,0) and back. $$anonymous$$eep in mind that Slerp is for direction vectors and not positions as the arc will always be around (0,0,0). This script will actually measure the speed at which the object moves along the arc and it is constant throughout the movement.

```
using UnityEngine;
public class SlerpTest : MonoBehaviour
{
Vector3 old;
float speed;
float t;
void Update ()
{
old = transform.position;
t = Mathf.PingPong(Time.time * 0.5f, 1f);
transform.position = 5f*Vector3.Slerp(Vector3.up, Vector3.right, t);
Vector3 diff = transform.position - old;
speed = diff.magnitude / Time.deltaTime;
}
private void OnGUI()
{
GUILayout.Label("Current speed:" + speed);
GUILayout.Label("Current t:" + t);
}
}
```

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.