Hello,
Me and a group of classmates are currently working on creating a top down space-shooter game in which when the game starts, the system is created. We are running into the problem where it generates fine from an angle of 0 to 359, but when we try and restrict the angle(say 0 to 45) it does not accept that and spawns based on the 0 to 359 anyways.
One of the main chunks in in which this works is as follows.
if(Planets[spawn]==1)
{
int GenerateAngle = Random.Range(0,359);
xpos = ((spawn+1)*50) * Mathf.Sin(GenerateAngle);
zpos = ((spawn+1)*50) * Mathf.Cos(GenerateAngle);
Vector3 PlanetPosition = new Vector3(xpos,0,zpos);
Instantiate(SPlanet,PlanetPosition,transform.rotation);
transform.GetComponent("Moon").SendMessage("MoonCreate",PlanetPosition);
}
I’m not sure why it would be doing this, but any help would be great. Thank you!