Scripting orbits

I am now writing stars following circular orbits, like earth moving around sun and so forth. I am quite clueless about how to start with. Say, if I want a star moving around the sun, I need to calculate the angular speed then apply it to the star. How can do this in C#, small code example will help alot.

Thanks.

Here is my orbit script

using UnityEngine;
using System.Collections;

//This script makes an object orbit another object (planet around sun)
public class Orbit : MonoBehaviour {

	public float speed;
	public Transform Target;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
		//Rotate around the target at the given speed
		transform.RotateAround (Target.transform.position, Vector3.up, speed * Time.deltaTime);
	}
	
}

Just attach to whatever you want to orbit something, then set Target to whatever it should be rotating around.

Enjoy.

Ok, that’s great help. :stuck_out_tongue: Thanks so much.

deleted resolved. :stuck_out_tongue: