# How to create spiral Stairs

please how to created spiral stairs like in this picture below : spiral stairs
I used this code:

``````const spiralstairs = new THREE.BoxGeometry(5,20,1, 1, 20, 1);
const spiralmaterials = new THREE.MeshLambertMaterial({ color: 'green', wireframe:true,side: THREE.DoubleSide });
const spiralMesh = new THREE.Mesh(spiralstairs,spiralmaterials);
spiralMesh.position.y=5;
for(let i=0;i<42;i+=2){
spiralstairs.vertices[i].z=5*Math.sin(2*i*Math.PI/22);
spiralstairs.vertices[i].x=5*Math.cos(2*i*Math.PI/22);
}
for(let i=1;i<42;i+=2){
spiralstairs.vertices[i].z=5*Math.sin(2*i*Math.PI/22);
spiralstairs.vertices[i].x=5*Math.cos(2*i*Math.PI/22);
}

``````

I got This result :

To create spiral staircase, all youâ€™d really need is to create a single prefab of a step, with a column segment on one side, and a slight angle on the other side - then just duplicate that step, translate upwards, rotate, rinse-and-repeat. Generating tons of vertices in a loop seems not only tedious but also is likely going to be quite a bit slower.

1 Like

Generating the geometry in code is tedious, (but not neccessarily slower than loading it)â€¦
On the other handâ€¦ to texture it, youâ€™d have to synthesize/generate UVs as wellâ€¦ so as you said @mjurczyk for that it probably would be easiest to import a single stair step model and instance it.

(I didnâ€™t bother with instancingâ€¦ just clone() ing a loaded stair step meshâ€¦)