unity camera smooth follow code example
Example 1: camera follow
public Transform player;
public Vector3 offset;
void LateUpdate()
{
transform.position = player.position + offset;
}
Example 2: camera follow player unity smooth
// CAMERA FOLLOW PLAYER - IN FIXEDUPDATE
Vector3.SmoothDamp(cam.position, transform.position + cameraOffset, ref cameraVelocity, CameraFollowSmoothTime);
cam.position = cam.position + cameraVelocity * Time.deltaTime;