Math.radians = function(degrees) { return degrees * Math.PI / 180; }; var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); var renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); for(var i=0; i<5; i++) { var pair = i%2===0 ? 0 : 1; var hexax = new Hexa(scene, { x:i*2*Hexa.default.depth - i*2*Hexa.default.box_depth, z:(pair+0)*Hexa.default.depth, }); var hexax = new Hexa(scene, { x:i*2*Hexa.default.depth - i*2*Hexa.default.box_depth, z:(pair+2)*Hexa.default.depth, }); var hexax = new Hexa(scene, { x:i*2*Hexa.default.depth - i*2*Hexa.default.box_depth, z:(pair+4)*Hexa.default.depth, }); if(!pair) { var hexax = new Hexa(scene, { x:i*2*Hexa.default.depth - i*2*Hexa.default.box_depth, z:(pair*6)*Hexa.default.depth, }); } } // create a point light var pointLight = new THREE.PointLight(0xFFFFFF, 1); // set its position pointLight.position.x = 10; pointLight.position.y = 50; pointLight.position.z = 200; // add to the scene scene.add(pointLight); //camera.position.x = 100; //camera.position.y = 100; camera.position.z = 0; camera.position.x = 0; camera.position.y = 120; camera.rotation.z = -Math.radians(90); var controls = new THREE.OrbitControls( camera, renderer.domElement ); controls.enableDamping = true; controls.dampingFactor = 0.25; controls.enableZoom = false; function render() { requestAnimationFrame( render ); //cell.rotation.y +=0.05; renderer.render( scene, camera ); controls.update(); } render();