Kinect Skeleton Data for movement

Hi guys just wondering if anyone would know how to bind the kinect skeleton data to objects within a scene so that I would be able to control the objects possibly in place of a mouse ?Could I use this code even ?

  
#include "testApp.h"  
GLfloat lightOnePosition[] = {40.0, 40, 100.0, 0.0};  
GLfloat lightOneColor[] = {0.99, 0.99, 0.99, 1.0};  
  
GLfloat lightTwoPosition[] = {-40.0, 40, 100.0, 0.0};  
GLfloat lightTwoColor[] = {0.99, 0.99, 0.99, 1.0};  
  
//--------------------------------------------------------------  
void testApp::setup() {  
    pMouseX = 0;  
 pMouseY = 0;  
 qMouseX = 0;  
 qMouseY = 0;  
 rMouseX = 0;  
 rMouseY = 0;  
 sMouseX = 0;  
 sMouseY = 0;  
  
	ofSetVerticalSync(true);  
  
    //some model / light stuff  
    glEnable (GL_DEPTH_TEST);  
    glShadeModel (GL_SMOOTH);  
  
    /* initialize lighting */  
    glLightfv (GL_LIGHT0, GL_POSITION, lightOnePosition);  
    glLightfv (GL_LIGHT0, GL_DIFFUSE, lightOneColor);  
    glEnable (GL_LIGHT0);  
    glLightfv (GL_LIGHT1, GL_POSITION, lightTwoPosition);  
    glLightfv (GL_LIGHT1, GL_DIFFUSE, lightTwoColor);  
    glEnable (GL_LIGHT1);  
    glEnable (GL_LIGHTING);  
    glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);  
    glEnable (GL_COLOR_MATERIAL);  
  
    //load the squirrel model - the 3ds and the texture file need to be in the same folder  
  tableModel.loadModel("actualtable.3ds", 20);  
    teaModel.loadModel("cupatea.3ds", 20);  
    teapotModel.loadModel("teapot.3ds",20);  
    plateModel.loadModel("plate.3ds",20);  
    spoonModel.loadModel("spoon.3ds",20);  
  
    //you can create as many rotations as you want  
    //choose which axis you want it to effect  
    //you can update these rotations later on  
    tableModel.setScale(0.3, 0.2, 0.2);  
    teaModel.setScale(0.04,0.04,0.04);  
    teapotModel.setScale(0.15,0.15,0.15);  
    spoonModel.setScale(0.006,0.006,0.006);  
    plateModel.setScale(0.02,0.02,0.02);  
    teaModel.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);  
    teapotModel.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);  
   tableModel.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);  
    plateModel.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);  
    spoonModel.setPosition(ofGetWidth()/2, ofGetHeight()/2, 0);  
  
  
  
  
    ofSetLogLevel(OF_LOG_NOTICE);  
  
    numDevices = openNIDevices[0].getNumDevices();  
  
    for (int deviceID = 0; deviceID < numDevices; deviceID++){  
        //openNIDevices[deviceID].setLogLevel(OF_LOG_VERBOSE); // ofxOpenNI defaults to ofLogLevel, but you can force to any level  
        openNIDevices[deviceID].setup();  
        openNIDevices[deviceID].addDepthGenerator();  
        openNIDevices[deviceID].addImageGenerator();  
        openNIDevices[deviceID].addUserGenerator();  
        openNIDevices[deviceID].setRegister(true);  
        openNIDevices[deviceID].setMirror(true);  
		openNIDevices[deviceID].start();  
    }  
  
    // NB: Only one device can have a user generator at a time - this is a known bug in NITE due to a singleton issue  
    // so it's safe to assume that the fist device to ask (ie., deviceID == 0) will have the user generator...  
  
    openNIDevices[0].setMaxNumUsers(1); // defualt is 4  
    ofAddListener(openNIDevices[0].userEvent, this, &testApp::userEvent);  
  
    ofxOpenNIUser user;  
    user.setUseMaskTexture(true);  
    user.setUsePointCloud(true);  
    user.setPointCloudDrawSize(2); // this is the size of the glPoint that will be drawn for the point cloud  
    user.setPointCloudResolution(2); // this is the step size between points for the cloud -> eg., this sets it to every second point  
    openNIDevices[0].setBaseUserClass(user); // this becomes the base class on which tracked users are created  
                                             // allows you to set all tracked user properties to the same type easily  
                                             // and allows you to create your own user class that inherits from ofxOpenNIUser  
  
    // if you want to get fine grain control over each possible tracked user for some reason you can iterate  
    // through users like I'm doing below. Please not the use of nID = 1 AND nID <= openNIDevices[0].getMaxNumUsers()  
    // as what you're doing here is retrieving a user that is being stored in a std::map using it's XnUserID as the key  
    // that means it's not a 0 based vector, but instead starts at 1 and goes upto, and includes maxNumUsers...  
//    for (XnUserID nID = 1; nID <= openNIDevices[0].getMaxNumUsers(); nID++){  
//        ofxOpenNIUser & user = openNIDevices[0].getUser(nID);  
//        user.setUseMaskTexture(true);  
//        user.setUsePointCloud(true);  
//        //user.setUseAutoCalibration(false); // defualts to true; set to false to force pose detection  
//        //user.setLimbDetectionConfidence(0.9f); // defaults 0.3f  
//        user.setPointCloudDrawSize(2);  
//        user.setPointCloudResolution(1);  
//    }  
  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
    ofBackground(0, 0, 0);  
    pMouseX = mouseX;  
    pMouseY = mouseY;  
    qMouseX = mouseX;  
    qMouseY = mouseY;  
    rMouseX = mouseX;  
    rMouseY = mouseY;  
    sMouseX = mouseX;  
    sMouseY = mouseY;  
  
  
    for (int deviceID = 0; deviceID < numDevices; deviceID++){  
        openNIDevices[deviceID].update();  
    }  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	ofSetColor(255, 255, 255);  
ofImage myImage; //allocate space for variable  
myImage.loadImage("commercial-kitchen.jpg"); //allocate space in ram, decode jpg, load pixels.  
myImage.draw(0,0,1360,768);  
    ofPushMatrix();  
  
    for (int deviceID = 0; deviceID < numDevices; deviceID++){  
  
        // debug draw does the equicalent of the commented methods below  
   openNIDevices[deviceID].drawDepth(0, 0, 320, 260);  
     openNIDevices[deviceID].drawImage(1074,0, 320, 260);  
    openNIDevices[deviceID].drawSkeletons(0, 0, 320, 260);  
  
    }  
  
    // do some drawing of user clouds and masks  
    ofPushMatrix();  
    ofEnableBlendMode(OF_BLENDMODE_ALPHA);  
    int numUsers = openNIDevices[0].getNumTrackedUsers();  
    for (int nID = 0; nID < numUsers; nID++){  
        ofxOpenNIUser & user = openNIDevices[0].getTrackedUser(nID);  
        user.drawMask();  
        ofPushMatrix();  
        ofTranslate(320, 240, -1000);  
        user.drawPointCloud();  
        ofPopMatrix();  
    }  
    ofDisableBlendMode();  
    ofPopMatrix();  
  
  
  
  
  
    glTranslatef(ofGetWidth()/3,ofGetHeight()/1.25,0);  
        //tumble according to mouse  
        glRotatef(-105,1,0,0);  
        glRotatef(180,0,1,0);  
        glTranslatef(-ofGetWidth()/2,-ofGetHeight()/1.25,0);  
  
  
       tableModel.draw();  
         glPopMatrix();  
  
         glPushMatrix();  
  
        glTranslatef(ofGetWidth()/2,ofGetHeight()/1.15,0);  
       glRotatef(-qMouseY,1,0,0);  
        glRotatef(qMouseX,0,1,0);  
      teaModel.setRotation(0, 90, 1, 0, 0);  
    teaModel.setRotation(1, 270, 0, 0, 1);  
        glTranslatef(-ofGetWidth()/2,-ofGetHeight()/1.15,0);  
        teaModel.draw();  
         glPopMatrix();  
         glPushMatrix();  
        glTranslatef(ofGetWidth()/2,ofGetHeight()/1.25,0);  
        glRotatef(-pMouseY,1,0,0);  
        glRotatef(pMouseX,0,1,0);  
      teapotModel.setRotation(0, 90, 1, 0, 0);  
    teapotModel.setRotation(1, 270, 0, 0, 1);  
        glTranslatef(-ofGetWidth()/2,-ofGetHeight()/1.25,0);  
        teapotModel.draw();  
         glPopMatrix();  
         glPushMatrix();  
        glTranslatef(ofGetWidth()/2,ofGetHeight()/1.25,0);  
        glRotatef(-rMouseY,1,0,0);  
        glRotatef(rMouseX,0,1,0);  
      plateModel.setRotation(0, 90, 1, 0, 0);  
    plateModel.setRotation(1, 270, 0, 0, 1);  
        glTranslatef(-ofGetWidth()/2,-ofGetHeight()/1.25,0);  
        plateModel.draw();  
         glPopMatrix();  
         glPushMatrix();  
        glTranslatef(ofGetWidth()/2,ofGetHeight()/1.25,0);  
        //tumble according to mouse  
        glRotatef(-sMouseY,1,0,0);  
        glRotatef(sMouseX,0,1,0);  
      spoonModel.setRotation(0, 90, 1, 0, 0);  
    spoonModel.setRotation(1, 270, 0, 0, 1);  
        glTranslatef(-ofGetWidth()/2,-ofGetHeight()/1.25,0);  
        spoonModel.draw();  
         glPopMatrix();  
    glPopMatrix();  
  
}  
  
  
//--------------------------------------------------------------  
void testApp::userEvent(ofxOpenNIUserEvent & event){  
    ofLogNotice() << getUserStatusAsString(event.userStatus) << "for user" << event.id << "from device" << event.deviceID;  
}  
  
//--------------------------------------------------------------  
void testApp::exit(){  
    // this often does not work -> it's a known bug -> but calling it on a key press or anywhere that isnt std::aexit() works  
    // press 'x' to shutdown cleanly...  
    for (int deviceID = 0; deviceID < numDevices; deviceID++){  
        openNIDevices[deviceID].stop();  
    }  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed(int key){  
    int cloudRes = -1;  
    switch (key) {  
        case '1':  
            cloudRes = 1;  
            break;  
        case '2':  
            cloudRes = 2;  
            break;  
        case '3':  
            cloudRes = 3;  
            break;  
        case '4':  
            cloudRes = 4;  
            break;  
        case '5':  
            cloudRes = 5;  
            break;  
        case 'x':  
            for (int deviceID = 0; deviceID < numDevices; deviceID++){  
                openNIDevices[deviceID].stop();  
            }  
            break;  
        case 'i':  
            for (int deviceID = 0; deviceID < numDevices; deviceID++){  
                if (openNIDevices[deviceID].isImageOn()){  
                    openNIDevices[deviceID].removeImageGenerator();  
                    openNIDevices[deviceID].addInfraGenerator();  
                    continue;  
                }  
                if (openNIDevices[deviceID].isInfraOn()){  
                    openNIDevices[deviceID].removeInfraGenerator();  
                    openNIDevices[deviceID].addImageGenerator();  
                    continue;  
                }  
            }  
            break;  
        case 'b':  
            for (int deviceID = 0; deviceID < numDevices; deviceID++){  
                openNIDevices[deviceID].setUseBackBuffer(!openNIDevices[deviceID].getUseBackBuffer());  
            }  
            break;  
        default:  
            break;  
    }  
    for (int deviceID = 0; deviceID < numDevices; deviceID++){  
		openNIDevices[deviceID].setPointCloudResolutionAllUsers(cloudRes);  
	}  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(int x, int y, int button){  
  
}  
  
//--------------------------------------------------------------  
void testApp::windowResized(int w, int h){  
  
}  
  

Thanks