using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Kamera : MonoBehaviour
{
    [SerializeField] private GameObject obserwowanyObiekt;
    private Vector3 odleglosc;
    
    // Start is called before the first frame update
    void Start()
    {
        odleglosc = transform.position 
                    - obserwowanyObiekt.transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        transform.LookAt(obserwowanyObiekt.transform.position);
        
        transform.position = Vector3.Lerp(
            transform.position,
            obserwowanyObiekt.transform.position + odleglosc,
            0.05f
            );
    }
}
