Let me preface this post by saying that I realize I am not using lerp properly in the following code example. That’s why I’m here. I would like to understand how to use lerp properly in a situation like this.
// manually rotate cam around player after race ended:
// 1: rotate around the player at a gradual rate
Camera.main.transform.RotateAround(transform.position, Vector3.up, Time.deltaTime * (RACE_ENDED_ROTATION +
(RACE_ENDED_ROTATION * Mathf.Abs(Mathf.Sin(Time.time / 16f)))));
// 2: gradually zoom in and out (towards the player), slowly moving slightly more outwards with each Sine cycle
Camera.main.transform.position += Camera.main.transform.forward * Time.deltaTime * 0.2f * (Mathf.Sin(Time.time / 3f) - 0.05f);
// 3: look directly towards player, but slowly transition to the player if we just ended.
Camera.main.transform.LookAt(Time.time - raceEndedTime > 4f ? this.transform.position :
Vector3.Lerp(
Camera.main.transform.position + (Camera.main.transform.forward * 0.5f),
this.transform.position,
(Time.time - raceEndedTime) / 2f));
So basically, I am working on a little animation that smoothly rotates around the player after they are done a level. Here is what it currently looks like:

For the most part, the animation is fine, it’s just that for “step 3” the code doesn’t really make sense, it’s not using lerp properly, so it’s weird to properly configure or adjust. The start position is constantly changing. The animation happens near instantly, while the code at a glance suggests it should last 2 seconds. I can make it smoother by changing up the numbers, but I’d like to understand if there’s any “proper method” to using lerp in a situation like this. I have a similar solution using SmoothDamp that works better, but it has the same issue of the start position changing, and the code not really making sense.
From reading various posts and articles, I understand that the proper way to use lerp is to have a start position and destination position that don’t change. However, this does not apply to my situation. Every frame, the start position of this new animation SHOULD be changing, as the camera is already moving, but that means I am unable to interpolate at a linear rate. I don’t really know how to explain it properly, it just doesn’t work as expected if I save the camera’s position when the race ends and use that in the lerp - the camera ends up looking off to the right, since it is moving to the left but that movement is not accounted for in the fixed start position.
Does anyone know how to make lerp work in a situation like this, where the target object’s position being modified is already moving? Any advice would be greatly appreciated. Understanding this would also allow me to clean up many other similar behaviors in this project.