var initScene = function () {
    window.scene = new THREE.Scene();
    window.renderer = new THREE.WebGLRenderer({
        alpha: true
    });

    window.renderer.setClearColor(0x000000, 1);
    window.renderer.setSize(window.innerWidth, window.innerHeight);

    window.renderer.domElement.style.position = 'fixed';
    window.renderer.domElement.style.top = 0;
    window.renderer.domElement.style.left = 0;
    window.renderer.domElement.style.width = '100%';
    window.renderer.domElement.style.height = '100%';

    document.body.appendChild(window.renderer.domElement);

    var directionalLight = new THREE.DirectionalLight( 0xffffff, 1 );
    directionalLight.position.set( 0, 0.5, 1 );
    window.scene.add(directionalLight);

    window.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000);
    window.camera.position.fromArray([0, 0, 250]);
    window.camera.lookAt(new THREE.Vector3(0, 0, 0));

    window.addEventListener('resize', function () {

        camera.aspect = window.innerWidth / window.innerHeight;
        camera.updateProjectionMatrix();
        renderer.setSize(window.innerWidth, window.innerHeight);
        renderer.render(scene, camera);

    }, false);

    scene.add(camera);

    var geometry = new THREE.BoxGeometry(25, 25, 150);
    var material = new THREE.MeshPhongMaterial({color: 0x15bdde});
    window.cube = new THREE.Mesh(geometry, material);

    window.pos_x = 50;
    window.pos_y = 0;
    window.pos_z = 0;

    cube.position.set(window.pos_x, window.pos_y, window.pos_z);
    cube.castShadow = true;
    cube.receiveShadow = true;
    scene.add(cube);

    renderer.render(scene, camera);
};

var initMyo = function() {
    "use strict";

    window.hub = new Myo.Hub();

    window.quaternion = new THREE.Quaternion();

    window.hub.on('ready', function() {
        console.log("ready");
    });

    window.hub.on('connect', function() {
        console.log("connected");
    });

    window.hub.on('disconnect', function() {
        console.log("disconnect");
    });

    window.hub.on('frame', function(frame) {

        console.log(frame);

        window.quaternion.x = frame.rotation.y;
        window.quaternion.y = frame.rotation.z;
        window.quaternion.z = -frame.rotation.x;
        window.quaternion.w = frame.rotation.w;

        if(!window.baseRotation) {
            window.baseRotation = quaternion.clone();
            window.baseRotation = window.baseRotation.conjugate();
        }

        window.quaternion.multiply(baseRotation);
        window.quaternion.normalize();
        window.quaternion.z = quaternion.z;

        window.cube.setRotationFromQuaternion(window.quaternion);

        renderer.render(scene, camera);
    });
};
initScene();
initMyo();
@@ -1240,24 +1240,25 @@
 d(camera);%0A%0A
+%0A
     var geom
@@ -1290,17 +1290,16 @@
 try(
-25, 25
+50, 50
 , 
-1
 50);
@@ -1366,16 +1366,17 @@
 bdde%7D);%0A
+%0A
     wind
@@ -1421,16 +1421,48 @@
 erial);%0A
+    %0A    // Set initial position
 %0A    win
@@ -1473,17 +1473,16 @@
 pos_x = 
-5
 0;%0A    w
@@ -1521,12 +1521,14 @@
 z = 
+-20
 0;%0A
-%0A
     
@@ -1587,16 +1587,32 @@
 .pos_z);
+%0A%0A    // Shadows
 %0A    cub
@@ -1658,24 +1658,54 @@
 adow = true;
+%0A%0A    // Add cube to the scene
 %0A    scene.a
@@ -1711,24 +1711,30 @@
 add(cube);%0A%0A
+%0A    %0A
     renderer
@@ -1835,25 +1835,24 @@
  Myo.Hub();%0A
-%0A
     window.q
@@ -2187,32 +2187,34 @@
 ame) %7B%0A%0A        
+//
 console.log(fram
@@ -2831,16 +2831,17 @@
  %7D);%0A%7D;%0A
+%0A
 initScen

reset to small square