using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {

    GameObject player;
    GameObject[] lanes;
    Player playercomp;
    Vector3 lookat;
	// Use this for initialization
	void Start () {
        player = GameObject.Find("Player");
        playercomp = player.GetComponent<Player>();
        lookat = player.transform.position;
	}
	
	// Update is called once per frame
	void Update () {
        Vector3 newPos = new Vector3(transform.position.x, transform.position.y, playercomp.PosXLane(playercomp.lane).z);
        this.transform.position = Vector3.Lerp(transform.position, newPos, 0.01f);
        this.transform.RotateAround(transform.forward, 0.001f*Mathf.Sin(Time.time%(Mathf.PI*2.0f)));
	}
}
