JavaScript Voxel Building Tutorial - Part 2 (Stairwell Construction)


#1
  • This tutorial will help you build a stairwell on the ground level of your respective plot. Throughout this example I will use my specific coordinates. Simply plug in your respective coordinates to begin your build.

Step 1: Stairwell Construction

  • Here is an example of how to create a stairwell on the ground level of your plot.

    // Function to make a stairwell on the ground position of your plot.
    function makeStairwell()
    {
    // Create variables and set to initial voxel build position.
    var x = 6273;
    var y = 195.75;
    var z = 7002;

      // Erase surrounding ceiling voxels to allow avatars to fit through to reach the next floor. 
      Voxels.eraseVoxel(6274, 195, 7002, 1);
      Voxels.eraseVoxel(6274, 195, 7003, 1);
      Voxels.eraseVoxel(6274, 195, 7004, 1); 
      Voxels.eraseVoxel(6273, 195, 7002, 1);
      Voxels.eraseVoxel(6273, 195, 7003, 1);
      Voxels.eraseVoxel(6273, 195, 7004, 1);
    
      // Create a stairwell which creates voxels across the Z axis and down the Y axis and loop the process until the lower bounds of your floor are reached.
      while (y > 191.75 && z < 7006)
      {
      	do
    		{
      		Voxels.setVoxel(x, y, z, .25, 0, 0, 255);
      		x = x + .25;
    		}
      	while (x <= 6274);
    
      	x = 6273;
      	y = y - .25;
      	z = z + .25;
      }
    
          // Stop script.
          Script.stop();
    

    }

    Script.update.connect(makeStairwell);