var target : Transform;
var k=20.0;
var damping=5.0;
var maxDist=8.0;

private var speed : Vector3 = Vector3(0,0,0);

function FixedUpdate () {
	if ((target.position - transform.position).magnitude > maxDist) {
		transform.position = target.position;
		speed = Vector3(0, 0, 0);
	} else {
		speed += (target.position - transform.position) * k * Time.deltaTime;
		speed += -speed * damping * Time.deltaTime;
		transform.position += speed * Time.deltaTime;
	}
}