Skip to content

Instantly share code, notes, and snippets.

@Adrianl3d
Created July 9, 2014 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adrianl3d/bbd6b38bd051188a29ae to your computer and use it in GitHub Desktop.
Save Adrianl3d/bbd6b38bd051188a29ae to your computer and use it in GitHub Desktop.
Voxel Chess Board
// chessBoard.js
// Simple 1 meter square chessboard with black and white checker pattern using 0.125 meter voxels.
// Created by Adrian on 9 July 2014
// Copyright 2014 Adrian McCarlie
// Released under Creative Commons By Attribution Share Alike, feel free to modify and share.
// YOU MUST CHANGE these 3 values to suit the position of the chess board.
var X_POS = 200;
var Y_POS = 1000;
var Z_POS = 200;
//
var size = 1;
var color = 255;
//
var x = X_POS;
var y = Y_POS;
var z = Z_POS;
function chessBoard()
{
while (z < (Z_POS + size))
{
while (x < (X_POS + size-0.125))
{
if (color == 1){color = 255;}else {color = 1;} // alternating black/white
Voxels.setVoxel(x, y, z, 0.125, color, color, color);
x=x+0.125;
}
x = X_POS;
z=z+0.125;
}
x = X_POS + 0.8750
z = Z_POS;
while (z < (Z_POS + size))
{
if (color == 225){color = 1;}else {color = 225;}
Voxels.setVoxel(x, y, z, 0.125, color, color, color);
z=z+0.125;
}
Script.stop();
}
chessBoard();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment