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.http://jsfiddle.net/29kLct0y/13/#
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;
var cRotate_up = false;
var cRotate_down = false;
var cRotate_centre = 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, 1, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 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 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...