using UnityEngine;
using System.Collections;

public class TrailTarget : MonoBehaviour {
	public Transform Target;
	public float TrailRate;

	private Vector2 relativeStart;
	private float trail=0;

	// Use this for initialization
	void Start () {
		relativeStart = transform.position - Target.position;
	}
	
	void FixedUpdate () {
		Vector3 pos = Target.position + (Vector3)relativeStart + new Vector3(0, -trail);
		transform.position = new Vector3(transform.position.x, pos.y, 0);
		trail += TrailRate * Time.fixedDeltaTime;
	}
}
