# Spawn in rotation

Hi can any one help me with a formula or other way to make a spawn in rotation ?
Lets say i want to position 10 geometries in circle , how could i do it? What i need is to give a circular formation to soldiers ,and make a circular city , with houses all around a center building , but i cant finde a right way.
And a city might grow , soo circle will be larger and larger ,soo i just cant give a static coordinates, but need for some formula or similar

1 Like

What do you want to start with and what do you want to end with?

Seems like really beginner trigonometry to me so there must be something Iām missing.

``````        float ringRadius = 5f;
int numBuildings = 10;
for (int buildingI = 0; buildingI < numBuildings; buildingI++) {
rootNode.attachChild(cgModel);

float theta = buildingI * FastMath.TWO_PI / numBuildings;
float x = ringRadius * FastMath.sin(theta);
float z = ringRadius * FastMath.cos(theta);
cgModel.move(x, 0f, z);
cgModel.rotate(0f, theta, 0f);
}
``````
4 Likes