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

public class LightAttractor : MonoBehaviour {

    [SerializeField]
    GameObject gravityPoint;


    public Vector3 axis;
    public Vector3 desiredPosition;
    public float radius = 2.0f;
    public float radiusSpeed = 10f;
    public float rotationSpeed = 80.0f;
    Transform center; 

	private void Start()
	{
        
        center = gravityPoint.transform;

        transform.position = (transform.position - center.position).normalized * radius + center.position;
	}

	private void Update()
	{
        transform.RotateAround (center.position, axis, rotationSpeed * Time.deltaTime);
        desiredPosition = (transform.position - center.position).normalized * radius + center.position;
        transform.position = Vector3.MoveTowards(transform.position, desiredPosition,Time.fixedDeltaTime * radiusSpeed);
	}


}
