# Camera Transition between 2 position / rotation, and follow a 3rd target

I have setup a transition of camera between 2 transform, here the result in video: https://youtu.be/rcwQ6KuEfMw

I have the information of the 2 transform: - position (vector3) - rotation (Quaternion)

And I do a Lerp, from Position1 to Position 2, and from Rotation1 to Rotation2:

Vector3 finalPosition = Vector3.Lerp(previousPosition, nextPosition, evaluateValueLerp);
Quaternion finalRotation = Quaternion.Slerp(previousRotation, nextRotation, evaluateValueLerp);


Now the problem is, as you can see in the video: the player target (the car) is lost durring the transition, I would like to keep it always in the view.

How can I manage to do it ?

Thanks you !

• you can add a new position between your position A and position B, first translate from A to a new position and from new position to position B. by that way you can easily solve the problem. I am assuming start position as position A and end position as position B. Sep 5 '19 at 7:52
• Add a new position, or a new Transform ? (if I only add a Vector3 position, the rotation will be the same). I am guessing you mean add a Transform, with position & rotation, and do what you say: (do transition from A to X, then from X to B (X being the new rotation) Sep 5 '19 at 9:24
• Add a new transform, you need to change position and rotation. Sep 5 '19 at 9:26
• I'd approach it differently - create a gameobject which contains your camera, then parent that gameobject to the car. Rotating the gameobject will make the camera orbit the car, and have it always at a specific location (depending on your camera's local transform). Feb 10 '20 at 13:08

I would 'move' the camera as you are doing now, but just use LookAt, or LookRotation, to point at the target. Lerping the transform.position should give you a smooth transition to the camera's rotation anyway, without the need to Slerp, but you could add some damping once you've got it working.

Try this

public Transform target;

transform.LookAt(target);



attach this to camera

• You'll need a bit more code there for this to be a valid script. You probably want the transform.LookAt to be inside an Update or LateUpdate method. Jun 10 '20 at 13:31