Skip to content

Instantly share code, notes, and snippets.

@Adrianl3d
Last active August 29, 2015 14: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/b8ddcdcb78c24c101ddd to your computer and use it in GitHub Desktop.
Save Adrianl3d/b8ddcdcb78c24c101ddd to your computer and use it in GitHub Desktop.
Green Gables a simple 2 level house in javascript for High Fidelity.
// eraseGreenGables.js
// Simple 2 level house removal script greenGables v0.1
// Created by Adrian on 30 April 2014
// Copyright 2014 Adrian McCarlie
// Released under Creative Commons By Attribution Share Alike, feel free to modify and share.
// Default Erase a 60 mtr x 60 mtr building created with "greenGables.js" Version 0.1
// Constants at lines 12 to 17 must match values on greenGables.js
//CONSTANTS
var X_POS = 100; // this MUST be changed according to your greenGables.js co-ords
var Y_POS = 100; // this MUST be changed according to your greenGables.js co-ords (floor)
var Z_POS = 100; // this MUST be changed according to your greenGables.js co-ords
var W = 60; //optional-change this to the width of your house
var H = 10; //optional-change this to the height of each level
var L = 60; //optional-change this to the length of your house
//variables
var x = X_POS;
var y = Y_POS;
var z = Z_POS;
var b = L;
var a = 0;
function eraseHouse()
{
while (z<=(Z_POS+L))
{
while (x<=(X_POS+W)) //erase floors
{
Voxels.eraseVoxel(x, Y_POS, z, 1.0);
Voxels.eraseVoxel(x, Y_POS+H, z, 1.0);
x++
}
x = X_POS;
z++;
}
z = Z_POS;
while (y < (Y_POS+(H*2)))
{
while (x<=(X_POS+W))
{
Voxels.eraseVoxel(x, y, Z_POS, 1.0); //erase purple wall
Voxels.eraseVoxel(x, y, Z_POS+L, 1.0); //erase yellow wall
x++;
}
while (z<(Z_POS+L))
{
Voxels.eraseVoxel(X_POS, y, z, 1.0); //erase blue wall
Voxels.eraseVoxel(X_POS+W, y, z, 1.0); //erase red wall
z++;
}
x = X_POS;
z = Z_POS;
y++;
}
}
function eraseGable()
{
y = (Y_POS+(H*2));//
while (y < (Y_POS+(H*2)+16))
{
while (z<=(Z_POS+(b+1)))
{
Voxels.eraseVoxel(X_POS, y, z, 1.0); //erase green gable on blue wall
Voxels.eraseVoxel(X_POS+W, y, z, 1.0); //erase green gable on red wall
z++;
}
a = (a+2)
z = (Z_POS+a);
y++;
b = (b-2);
}
}
function eraseRoof()
{
x = X_POS;
z = Z_POS;
y = (Y_POS + (H*2))
while (z<=((Z_POS-2)+(L/2)))
{
while (x<=(X_POS+W))
{
Voxels.eraseVoxel(x, y, z, 1.0); //erase roof up
Voxels.eraseVoxel(x, y, z+1, 1.0);
x++;
}
y++;
x = X_POS;
z=(z+2);
}
while (z<=(Z_POS+L))
{
while (x<=(X_POS+W))
{
Voxels.eraseVoxel(x, y, z, 1.0); //erase roof down
Voxels.eraseVoxel(x, y, z+1, 1.0);
x++;
}
y--;
x = X_POS;
z = (z+2);
}
Script.stop();
}
eraseHouse();
eraseGable();
eraseRoof();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment