I’m basically trying to increment the point out from the center by incrementing the angle in steps. This certainly isn’t right though.
private Vector3 pos;
private float radius;
private float angle;
private float speed;
private Vector3 centerPos;
private Vector3 nextPoint;
public float angularSpeed;
// Use this for initialization
void Start () {
pos = transform.position;
centerPos = transform.position;
angle = 1.0f;
radius = 8.0f;
angularSpeed = 7.0f;
}
// Update is called once per frame
void Update () {
angle = (angle + 1 * Time.deltaTime) % 360;
float x = centerPos.x + (radius * Mathf.Cos(angle * Mathf.Deg2Rad));
float y = centerPos.y + (radius * Mathf.Sin(angle * Mathf.Deg2Rad));
transform.position = new Vector3 (x, y, 0.0f) * radius * Time.deltaTime * angularSpeed;
}
How can I rotate around this path? I’d like to learn this method, because I want to be able to control when the rotation stops at desired angles.