templates/scripts/libs/framework.js
function(message) {
    if (this.sendData % 200 == 0){
      console.log("Kinect data being sent from kinect");
      console.log(message);
    }
    this.sendData = this.sendData +1;
    if (true) {
      //Set the kinect data to the raw values from the kinect
      for(var key in message){
        KinectState[key] = message[key];
      }

      if (this.currentState == 1){
        //We don't have any person data yet.
      }else if (this.currentState == 2){
        var h = KinectState.head;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);
      }
      else if (this.currentState == 3)
      {
        var h = KinectState.head;
        var l = KinectState.leftHand;
        var r = KinectState.rightHand;
        var el = KinectState.leftElbow;
        var er = KinectState.rightElbow;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);

        User.updateObj(User.hands.left, l.x,l.y,l.z, l.xmm, l.ymm);
        User.updateObj(User.hands.right, r.x,r.y,r.z, r.xmm, r.ymm);

        User.updateObj(User.elbows.left, el.x, el.y, el.z, el.xmm, el.ymm);
        User.updateObj(User.elbows.right, er.x, er.y, er.z, er.xmm, er.ymm);
      }
      //Tell the app the state has changed
      this.setState(KinectState.phase);
    }
  }
function(message) {
    if (this.sendData % 200 == 0){
      console.log("Kinect data being sent from kinect");
      console.log(message);
    }
    this.sendData = this.sendData +1;
    if (true) {
      //Set the kinect data to the raw values from the kinect
      for(var key in message){
        KinectState[key] = message[key];
      }

      if (this.currentState == 1){
        //We don't have any person data yet.
      }else if (this.currentState == 2){
        var h = KinectState.head;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);
      }
      else if (this.currentState == 3)
      {
        var h = KinectState.head;
        var l = KinectState.leftHand;
        var r = KinectState.rightHand;
        var el = KinectState.leftElbow;
        var er = KinectState.rightElbow;
        User.updateObj(User.head,h.x,h.y,h.z, h.xmm, h.ymm);

        User.updateObj(User.hands.left, l.x,l.y,l.z, l.xmm, l.ymm);
        User.updateObj(User.hands.right, r.x,r.y,r.z, r.xmm, r.ymm);

        User.updateObj(User.elbows.left, el.x, el.y, el.z, el.xmm, el.ymm);
        User.updateObj(User.elbows.right, er.x, er.y, er.z, er.xmm, er.ymm);
      }
      //Tell the app the state has changed
      this.setState(KinectState.phase);
    }
  }
function ( message ) { if ( this . sendData % 200 == 0 ) { console . log ( "Kinect data being sent from kinect" ) ; console . log ( message ) ; } this . sendData = this . sendData + 1 ; if ( true ) { //Set the kinect data to the raw values from the kinect for ( var key in message ) { KinectState [ key ] = message [ key ] ; } if ( this . currentState == 1 ) { //We don't have any person data yet. } else if ( this . currentState == 2 ) { var h = KinectState . head ; User . updateObj ( User . head , h . x , h . y , h . z , h . xmm , h . ymm ) ; } else if ( this . currentState == 3 ) { var h = KinectState . head ; var l = KinectState . leftHand ; var r = KinectState . rightHand ; var el = KinectState . leftElbow ; var er = KinectState . rightElbow ; User . updateObj ( User . head , h . x , h . y , h . z , h . xmm , h . ymm ) ; User . updateObj ( User . hands . left , l . x , l . y , l . z , l . xmm , l . ymm ) ; User . updateObj ( User . hands . right , r . x , r . y , r . z , r . xmm , r . ymm ) ; User . updateObj ( User . elbows . left , el . x , el . y , el . z , el . xmm , el . ymm ) ; User . updateObj ( User . elbows . right , er . x , er . y , er . z , er . xmm , er . ymm ) ; } //Tell the app the state has changed this . setState ( KinectState . phase ) ; } }
handles WS message
handles WS message