struggling with the math
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;
}
}
}
Answer by JamesLawrenceMyQVO · Jul 20, 2016 at 02:13 PM
I'm not sure I understand exactly what you want. Is the example .png what you want it to be, or just how the squares are arranged? If they are square, they won't maintain a uniform distance between them over the length of the square, let alone over multiple radius concentric circles of the squares. Can you give a small example with maybe 8 or so sprites to show what you are going for?
Answer by LazyBassTurd · Jul 20, 2016 at 04:56 PM
I changed it to start from the outer most ring (concentric circle) and go inwards and I'm getting close the first three rings seem ok but, it still goes off after a few rings.

Your answer