JavaScript
var engine = new BABYLON.Engine(document.getElementById('canvas'), true);
var scene = new BABYLON.Scene(engine);
var WALL_SIZE = 50,
walls = []
grounds = [],
map = [
[2,2,2,2,2,2,2,2,2,2],
[2,0,0,2,0,0,0,0,0,2],
[2,0,0,1,0,0,0,0,0,2],
[2,0,0,1,1,1,0,0,0,2],
[2,0,0,0,0,1,0,0,0,1],
[2,2,2,2,0,1,0,0,0,1],
[2,0,0,2,0,1,1,0,1,1],
[2,0,0,2,0,0,0,0,0,2],
[2,0,0,0,0,0,0,0,0,2],
[2,2,2,2,2,2,1,1,1,2]
];
var camera = new BABYLON.ArcRotateCamera('camera', 150, 0.8, 150, new BABYLON.Vector3(0, 0, 0), scene);
camera.mode = BABYLON.Camera.PERSPECTIVE_CAMERA;
camera.setPosition(new BABYLON.Vector3(0, 700, 200));
scene.activeCamera.attachControl(canvas);
var material = new BABYLON.StandardMaterial("sm", scene);
var lightAngle = 160 * Math.PI / 180;
light = new BABYLON.SpotLight("light", new BABYLON.Vector3(-200, 0, 100), new BABYLON.Vector3(1, -0.7, -0.6), lightAngle, lightAngle, scene);
light.diffuse = new BABYLON.Color3(1, 1, 1);
light.specular = new BABYLON.Color3(1, 1, 1);
var wMap = map[0].length,
hMap = map.length,
dx = Math.floor(hMap * WALL_SIZE / 2),
dz = Math.floor(wMap * WALL_SIZE / 2);
for (var i = 0, n = 0, ground, size = WALL_SIZE * 2; i < 5; i++) {
for (var j = 0; j < 5; j++, n++) {
ground = BABYLON.Mesh.CreateGround('ground', size, size, 1, scene);
ground.position = new BABYLON.Vector3(
(size * i) - dx + WALL_SIZE / 2,
0,
(size * j) - dz + WALL_SIZE / 2
);
...