Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Created January 10, 2013 05:15
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 max-mapper/4499643 to your computer and use it in GitHub Desktop.
Save max-mapper/4499643 to your computer and use it in GitHub Desktop.
voxeljs cat face
var THREE = game.THREE
function helper(o, x, y, z, w, h, d, c){
var material = new THREE.MeshLambertMaterial( { color: c} );
var geometry = new THREE.CubeGeometry(w, h, d, 1, 1, 1);
var mesh = new THREE.Mesh( geometry, material );
mesh.position.x=x+(w/2);
mesh.position.y=y-(h/2);
mesh.position.z=z+(d/2);
o.add( mesh );
}
//FACE
var face=new THREE.Object3D();
helper( face, 2, -3, -3, 12, 9, 4, 0x222222);
helper( face, 0, -5, 0, 16, 5, 1, 0x222222);
helper( face, 1, -1, 0, 4, 10, 1, 0x222222);
helper( face, 11, -1, 0, 4, 10, 1, 0x222222);
helper( face, 3, -11, 0, 10, 2, 1, 0x222222);
helper( face, 2, 0, 0, 2, 2, 1, 0x222222);
helper( face, 4, -2, 0, 2, 2, 1, 0x222222);
helper( face, 12, 0, 0, 2, 2, 1, 0x222222);
helper( face, 10, -2, 0, 2, 2, 1, 0x222222);
helper( face, 1, -5, .5, 14, 5, 1, 0x999999);
helper( face, 3, -4, .5, 10, 8, 1, 0x999999);
helper( face, 2, -1, .5, 2, 10, 1, 0x999999);
helper( face, 12, -1, .5, 2, 10, 1, 0x999999);
helper( face, 4, -2, .5, 1, 2, 1, 0x999999);
helper( face, 5, -3, .5, 1, 1, 1, 0x999999);
helper( face, 11, -2, .5, 1, 2, 1, 0x999999);
helper( face, 10, -3, .5, 1, 1, 1, 0x999999);
//Eyes
helper( face, 4, -6, .6, 2, 2, 1, 0x222222);
helper( face, 11, -6, .6, 2, 2, 1, 0x222222);
helper( face,3.99,-5.99, .6,1.01,1.01,1.01, 0xffffff);
helper( face,10.99,-5.99, .6,1.01,1.01,1.01, 0xffffff);
//MOUTH
helper( face, 5, -10, .6, 7, 1, 1, 0x222222);
helper( face, 5, -9, .6, 1, 2, 1, 0x222222);
helper( face, 8, -9, .6, 1, 2, 1, 0x222222);
helper( face, 11, -9, .6, 1, 2, 1, 0x222222);
//CHEEKS
helper( face, 2, -8, .6, 2, 2, .91, 0xff9999);
helper( face, 13, -8, .6, 2, 2, .91, 0xff9999);
face.position.copy(game.controls.yawObject.position)
game.scene.add(face);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment