public void StartMoCap()
 {
     gameObject.AddComponent <ConfigLoader>();
     KinectDevice           = gameObject.AddComponent <TrackerHandler>();
     KinectDevice.isKinect2 = isKinect2;
     KinectDevice.turnOnOffSkeletons(!DrawSkeleton);
     KinectDevice.turnOnOffSkeletons(DrawSkeleton);
     dp = gameObject.AddComponent <DataProvider>();
     if (isRealTime)
     {
         dp.StartAfterConfig();
     }
 }
    // Update is called once per frame
    private void Update()
    {
        if (configOn)
        {
            StartAfterConfig();
        }


        KinectDevice.turnOnOffSkeletons(DrawSkeleton);



        if (!configured || !isRealTime || !animationOn)
        {
            return;
        }

        if (resizeAvatar) //resize avatar
        {
            resizeAvatar = false;
            ResizeAvatar();
        }

        if (startRecording)
        {
            createAnimationRecorder();
            recorder.PrepareRecording();
            recorder.StartRecording();
            startRecording = false;
            isrecording    = true;
        }

        if (stopRecording)
        {
            recorder.StopRecording();
            stopRecording = false;
            isrecording   = false;
        }
    }