material,
0
);
beam.position.set(-37, 0, 0);
beam.receiveShadow = true;
varbeam2 =newPhysijs.BoxMesh(
newTHREE.CubeGeometry(50, 2, 200),
material
);
beam2.position.set(75, 0, 0);
beam2.receiveShadow = true;
beam.add(beam2);
varbeam3 =newPhysijs.BoxMesh(
newTHREE.CubeGeometry(200, 2, 50),
material
);
beam3.position.set(40, 0, -40);
beam3.receiveShadow = true;
beam.add(beam3);
varbeam4 =newPhysijs.BoxMesh(
newTHREE.CubeGeometry(200, 2, 50),
material
);
beam4.position.set(40, 0, 40);
beam4.receiveShadow = true;
beam.add(beam4);
beam.rotation.set(0.1, 0, 0);
scene.add(beam);
returnbeam;
}
functionaddControls() {
document.addEventListener("keydown",function(event) {
varcode = event.keyCode;
if(code == 37) left();
if(code == 39) right();
if(code == 38) up();
if(code == 40) down();
});
}
functionleft() { tilt('z', 0.02); }
functionright() { tilt('z', -0.02); }
functionup() { tilt('x', -0.02); }
functiondown() { tilt('x', 0.02); }
report erratum • discuss
Code: Tilt-a-Board • 251
Prepared exclusively for Michael Powell