JavaScript
var element = document.body;
var WIDTH = window.innerWidth,
HEIGHT = window.innerHeight;
var ASPECT = WIDTH / HEIGHT;
var UNITSIZE = 10; //...# of units along each side of the square grid
var scale = 1; //... cube edge length/width/height
var cubeR = 1.414/2; //... radius of bounding sphere.
var moverR = 0.25; //... mover radius for collision detection.
var WALLSIZE = 16; //unused???
var t = THREE, stats, loader;
var scene, camera, renderer, clock, controls, key;
var eddie;
var rotate_left = false;
var rotate_right = false;
//... 0 = floor, 1 = wall, 2 = spawn point
//... NB map[u][v] implies
//... u = rows: up to down (--> increasing z)
//... v = columns: left across to right (--> increasing x)
//... where --> are our chosen mappings
//... so that the pattern below mimics the pattern in the simulation
var map =
[
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 0, 0, 0, 0, 1, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 2, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
var objects = [];
var mouse = new t.Vector2();
var player;
var spawnSet;
var stop_forward = false;
var stop_back = false;
var stop_left = false;
var stop_right = false;
var Message = " <message>";
var reset_player = false ;
var pointerlockchange = function(event) {
if (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) {
controls.enabled = true;
} else {
controls.enabled = false;
}
};
function init() {
//stats = new Stats();
// stats.setMode(0);
//document.body.appendChild(stats.domElement);
renderer = new t.WebGLRenderer();
renderer.setSize(WIDTH, HEIGHT);
document.body.appendChild(renderer.domElement);
key =...