Adjusting the cube size involves keeping one face stationary while others move and change in position or dimension. The height, depth, and width must be expanded or contracted based on user input from the keyboard.
I have managed to create a cube, but so far I can only adjust its position.
cube.position.y -= 1
Unfortunately, changing the height, depth, and width of the cube seems impossible at the moment.
cube.geometry.parameters.height += 1
document.addEventListener("keydown", onDocumentKeyDown, false);
function onDocumentKeyDown(event) {
var keyCode = event.which;
// up
if (keyCode == 87) {
mesh.geometry.parameters.height += 1;
// down
} else if (keyCode == 83) {
mesh.position.y -= 1;
// left
} else if (keyCode == 65) {
mesh.position.x -= 1;
// right
} else if (keyCode == 68) {
mesh.position.x += 1;
// space
} else if (keyCode == 32) {
mesh.position.x = 0.0;
mesh.position.y = 0.0;
}
render();
};
The intended visual outcome is illustrated here: