Best way to move camera smoothly

Hello Eilios.

I’ve had the same problem. I solved it quite beautifully using the Math Function’s

FMath::FInterpTo(targetLength, desiredLength, deltaTime, zoomRate)

An Example of how used it is below:

// Smoothly interpolate the Target Arm Length to the desired arm length

  if (!FMath::IsNearlyEqual(CameraBoon->TargetArmLength, desiredBoonLength))
    {
        this->CameraBoon->TargetArmLength = FMath::FInterpTo(CameraBoon->TargetArmLength, desiredBoonLength, deltaTime, CameraZoomSpeed);
    }

I use the IsNearlyEqual because I am dealing with floats with some possible inaccuracy between them. CameraBoon is my spring arm the camera is attached to. Every time I “zoom in” or “zoom out” I add that value to my variabl desiredBoonLength. Then each tick I check to see if desiredBoonLength and TargetArmLength are not equal. If they are not, then I interp each tick until they are close enough.