//+rep Milan Seyed Mahmoud, the finder class CircleSpawn : ZilchComponent { //This script will spawn 1 object at a time. //This script needs to be added to Level Settings. //You can call the function SpawnToAngle in other scripts (for example on the enemy object controller script) //You can add this function call (or call it in a for loop) to add multiple enemies at different angles around a point. //This takes any angle in degrees, a distance, a point as a Real3, and an archetype and spawns the archetype //The spawned object will always be (distance) away from the point and (angle) degrees from the positive x-axis function SpawnToAngle(angleInput: Real, distance: Real, point : Real3, toSpawn : Archetype) { var angle = Math.ToRadians(angleInput); //This uses the input angle and the distance to determine the X and Y coordinates with Sin and Cosine operations var x = Math.Cos(angle)*distance; var y = Math.Sin(angle)*distance; var relativePosition = Real3(x, y, 0.0); //This moves the spawn position to a circle around the specified point //input (0.0,0.0,0.0)for origin, or any object.transform.translation to have them spawn around anything else. var position = point+relativePosition; //This adds the specified object at the calculated position, as well as printing the angle and position to the console this.Space.CreateAtPosition(toSpawn, position); Console.WriteLine("`position`"); Console.WriteLine("`angleInput`"); } }