This may be a little difficult to explain, I have a ring of square sprites which I would like to expand outwards while keeping a uniform distance between sprites and scaling them up from 0.5 (inner most ring) to 1 (outer most ring). I’m not really that good with maths just yet so, any help on achieving this would be greatly received.
using UnityEngine;
using System.Collections;
public class test : MonoBehaviour {
GameObject areaGo;
GameObject areaSprite;
public Sprite sprite;
int areaAmount = 120;
int layerAmount = 10;
float angle = 0f;
float angleOffset = 3f;
float intialPosition = 10f;
float initialScale = 0.5f;
void Start () {
for (int i_layer = 0; i_layer < layerAmount; i_layer++)
{
for (int i_area = 0; i_area < areaAmount; i_area++)
{
areaGo = new GameObject();
areaGo.name = "area_" + i_area;
areaSprite = new GameObject();
areaSprite.name = "areaSprite_" + i_area;
areaSprite.transform.parent = areaGo.transform;
areaSprite.AddComponent<SpriteRenderer>().sprite = sprite;
areaSprite.AddComponent<BoxCollider2D>();
areaSprite.transform.position = new Vector3(0f, intialPosition, 0f);
areaSprite.transform.localScale = new Vector3(initialScale, initialScale, 0f);
angle = +angleOffset * i_area;
areaGo.transform.Rotate(0f, 0f, angle);
Debug.Log(angleOffset);
}
intialPosition += 0.55f;
// initialScale += 0.005f;
}
}
}

