This is a very simple function and is really for a test purpose. Feel free to change it.


//Simple function to detect the keys pressed by the user. We just change the offsets and angles. function checkKeys() { if (Key.isDown(Key.RIGHT)) { xOffset += 4; } if (Key.isDown(Key.LEFT)) { xOffset -= 4; } if (Key.isDown(Key.UP)) { yOffset -= 4; } if (Key.isDown(Key.DOWN)) { yOffset += 4; } if (Key.isDown(Key.INSERT)) { angleY -= 0.001; } else { if (Key.isDown(Key.DELETEKEY)) { angleY += 0.001; } else { angleY *= 0.95; } } if (Key.isDown(Key.HOME)) { angleX += 0.001; } else { if (Key.isDown(Key.END)) { angleX -= 0.001; } else { angleX *= 0.95; } } if (Key.isDown(Key.PGDN)) { angleZ += 0.001; } else { if (Key.isDown(Key.PGUP)) { angleZ -= 0.001; } else { angleZ *= 0.95; } } }

The only thing this function does, is to change the angle and offset vars we declared in the previous page. Im also adding a bit of "inertia".

Next section is the render function.