Vector3.Lerp / Quaternion.Slerp

Hi There,

I would like main camera to change both position and angle at the same time (Lets say in 10 seconds)

It is easy with position:

float distCovered = (Time.time - startTime);
float fracJourney = distCovered / 10;

Camera.main.transform.position = Vector3.Lerp (startPosition, endPosition, fracJourney);

But how do handle rotation?

There is Quaternion.Slerp, that takes as third parameter T.
And how to calculate that T?

I believe it could sth like

Camera.main.transform.rotation = Quaternion.Slerp(startRotation, currenEndRotation, differenceBetweenTwoAngles * fracJourney);

thanks

It’s the same thing as lerp.

The third parameter is the same t.

The t is the percentage from start to end, so if you know the duration you’re currently at, and the total.

It quite literally is the SAME thing that you do in lerp.

Camera.main.transform.rotation = Quaternion.Slerp(startRotation, endRotation, fracJourney);