# If my camera does not change position but rotates, Does adding lerp do anything?

If my camera does not change position but rotates, Does lerp do anything?

        cameraposition = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position, Time.deltaTime * cameraLerp);
Camera.main.transform.position = cameraposition;
Camera.main.transform.LookAt(gameobject.transform.position);


These two lines together do nothing:

cameraposition = Vector3.Lerp(Camera.main.transform.position, Camera.main.transform.position, Time.deltaTime * cameraLerp);
Camera.main.transform.position = cameraposition;


Lerp is just a math function, that returns a value along the line between the first and second argument. If those two arguments are the same then it's just returning that argument, no matter what number you put in the third place (excluding NaNs and infinities as "not numbers")

So this is the same as:

a = lerp(b, b, t)
= (1-t) * b + t * b
= b

b = a


It does not leave any kind of residue behind that affects later operations like rotation.

If you want to smooth the rotation, you should use a Lerp or RotateTowards to compute the Quaternion orientation, not the position. eg:

Vector3 lookDirection = target.position - camera.position;
Quaternion targetOrientation = Quaternion.LookRotation(lookDirection);

camera.rotation = Quaternion.RotateTowards(
camera.rotation,
targetOrientation,
Time.deltaTime * degreesPerSecond
);

• Thanks a bunch. – TeachMeEverything May 11 '19 at 20:40