Hi guys, I am trying to create a GUI wheel with power-ups icons and having some trouble. I researched this quite a bit, and what I want it to do is put one gui element an equidistant space from the center of a circle area (thus creating a "power wheel"). However they are appearing unevenly spaced. I checked with some Debugs and it seems like the 360 degree circle is being split evenly according to the number of elements. Can you guys take a look at the code and point probable cause out? Thanks!
Debug.Log(angle);
rad = Screen.height * .00017f;
for(int i = 0; i < powerL.Length; i++){
//Debug.Log(angle);
tweenObject[i] = (GameObject)Instantiate(Resources.Load("3dText"));
tweenObject[i].transform.name = powerL[i];
tweenObject[i].transform.parent = spawnPoint.transform;
tweenObject[i].transform.position = new Vector3(.15f,.4f,.01f);
float X = tweenObject[i].transform.position.x + rad * Mathf.Cos(angle);
float Y = tweenObject[i].transform.position.y + rad * Mathf.Sin(angle);
Vector3 finalPos = new Vector3(X,Y, 0);
//Vector2 finalPos = new Vector3(X,Y, 16.2785f);
iTween.MoveTo(tweenObject[i].gameObject,finalPos, .5f);
angle = angle + (360 / powerL.Length);
Debug.Log(angle);
}
↧