I am trying to spawn 3 GameObjects around another GameObject with equal spacing between them. So far I have this:
var i : float;
for(i = 0; i < 3; i++){
var rot : float;
var spawnPos : Vector3;
rot = ((i+1/3) * (Mathf.PI * 2));
Debug.Log(i);
Debug.Log(rot);
spawnPos = new Vector3(5*Mathf.Cos(rot) + transform.position.x,
5*Mathf.Sin(rot) + transform.position.y,
transform.position.z);
var g : GameObject = Instantiate(gunPreFab, spawnPos, Quaternion.identity);
guns.Add(g.gameObject);
}
The variable “i” is being increased every loop cycle, however, “rot” never becomes anything other than zero. I am not sure at all why this is occurring.