using UnityEngine;
using System.Collections;

public class FollowCam : MonoBehaviour {
    
    public Transform player;
    public float velocity = 0.1f;
    Camera cam;

    void Start()
    {
        cam = GetComponent<Camera>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        if (!player)
            return;
        
            Vector3 npos = Vector3.Lerp(transform.position, player.position, velocity * Time.deltaTime);
            transform.position = new Vector3(npos.x, npos.y, cam.transform.position.z);
        
    }

    void OnDrawGizmos()
    {
    }
}
