using UnityEngine;
using System.Collections;

public class S_camera : MonoBehaviour 
{
	public GameObject playerTarget;
    public float damping = 1;
	Vector3 offset;
	
	
	// Use this for initialization
	void Start () 
	{
	
		offset = transform.position - playerTarget.transform.position;
		
	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}
	
	void LateUpdate() 
	{
		
	    Vector3 desiredPosition = playerTarget.transform.position + offset;
        Vector3 position = Vector3.Lerp(transform.position, desiredPosition, Time.deltaTime * damping);
        transform.position = position;
        		
	}
}
