# Lerp in circular motion

Hi,
right now I calculate the distance from my player and the nearest object, then my player lerps to the object. This works fine but I would like to make my player move in a circular motion to the nearest object.

The code i have right now to lerp;

``````		if (Input.GetKeyDown(KeyCode.W))
{
canJump = true;
}

if (canJump)
{
transform.position = Vector3.Lerp(transform.position,
closestPlat.GetComponent<Renderer>().bounds.center + new Vector3(0,
platformHeight, 0), Time.deltaTime * jumpspeed);
}
``````

What i tried:

``````		if (Input.GetKeyDown(KeyCode.W))
{
canJump = true;
}

if (canJump)
{
transform.position = transform.position + new Vector3(0, jumpforce, 0) *
Mathf.Sin(Mathf.PI * (Time.deltaTime) * jumpspeed);
transform.position = Vector3.Lerp(transform.position,
closestPlat.GetComponent<Renderer>().bounds.center + new Vector3(0,
platformHeight, 0), Time.deltaTime * jumpspeed);
}
``````

Use `Vector3.Slerp` method. Docs

Suppose your starting point is A, the goal is B, the center of circle is O

You can calculate current position of your object so

``````C = Vector3.Slerp(A - O, B - O, lerpValue) + O;
``````