[C#]Not sure how this orbit script works, could someone explain?

I found this orbit script on unity answers but I dont know how it works, could someone explain?

	GameObject cube;
	public Transform center;
	public Vector3 axis = Vector3.up;
	public Vector3 desiredPosition;
	public float radius = 2.0f;
	public float radiusSpeed = 0.5f;
	public float rotationSpeed = 80.0f;

	void Start () {
		cube = GameObject.FindWithTag("Cube");
		center = cube.transform;
		transform.position = (transform.position - center.position).normalized * radius + center.position;
		radius = 2.0f;
	}

	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.deltaTime * radiusSpeed);
	}

bump

The start function finds a Cube with the Tag Cube.
It then sets the center (the point you are going to rotate around) to be the cube’s location.
It then sets the current objects location a given distance away from the cube, based on a radius.

In the update function, the current object is then set to rotate around the cube at a given speed (rotationSpeed).
As it rotates, the desiredPosition is set to be a point from the given cube and then the position is set based on the radiusSpeed (how fast it revolves around the object).

Think that’s the basis of what its doing anyway.

You need to have a Cube setup in the scene tagged as Cube and then attach this to the object you want to orbit the cube.

Whats the difference between this and using rotateAround

if you just used RotateAround then that’s what it would do, rotate around the center object.

The second part smoothly moves your object to the desired distance from the center (the radius variable).