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

public class CamFollow : MonoBehaviour
{
    public Transform target;
    public float speed = 10;

    // Update is called once per frame
    void Update()
    {
        Vector3 dir = target.position - transform.position;
        dir.y = 0;
        dir.z = transform.position.z;
        Vector3 pos = transform.position;
        pos += dir * speed * Time.deltaTime;
        //transform.position = Vector2.MoveTowards(transform.position, target.position, speed * Time.deltaTime * xDist);
        pos.z = -10;
        transform.position = pos;
    }
}
