What you’re looking for is the RotateAround method. You may want to add some more logic, as this will rotate forever.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Update() {
transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
}
}
My math is quite rusty, but I think you can do something like this:
var cos = Math.Cos(angle);
var sin = Math.Sin(angle);
var rotatedX = x * cos - y * sin;
var rotatedY = x * sin + y * cos;
Note that you need to use System.Math.Cos, not UnityEngine.Mathf.Cos, since the former is using doubles and the latter is using floats. Also, mind the unit of angular measure, radian vs degree. Check the documentation.
Again, not sure if the math is right, but I think so and you’ll find out rather fast I’m sure.