void UpdateRotation(ZigJointId joint, Quaternion orientation)
    {
        joint = mirror ? mirrorJoint(joint) : joint;
        // make sure something is hooked up to this joint
        if (!transforms[(int)joint])
        {
            return;
        }

        if (UpdateOrientation)
        {
                if(count>102)
                {

                    if((int)joint==(int)ZigJointId.RightElbow ||  (int)joint==(int)ZigJointId.LeftElbow)
                     orientation=	DoubleExSmooth(joint,orientation,alphaElbow,betaElbow);
                     else
                     if((int)joint==(int)ZigJointId.LeftHip ||  (int)joint==(int)ZigJointId.RightHip)
                     orientation=	DoubleExSmooth(joint,orientation,alphaHip,betaHip);
                     else
                     if((int)joint==(int)ZigJointId.RightKnee ||  (int)joint==(int)ZigJointId.LeftKnee)
                                 orientation=	DoubleExSmooth(joint,orientation,alphaKnee,betaKnee);
                     else
                     if((int)joint==(int)ZigJointId.RightAnkle ||  (int)joint==(int)ZigJointId.LeftAnkle)
                                 orientation=	DoubleExSmooth(joint,orientation,alphaAnkle,betaAnkle);
                     else
                     if((int)joint==(int)ZigJointId.RightFoot ||  (int)joint==(int)ZigJointId.LeftFoot)
                             orientation=	DoubleExSmooth(joint,orientation,alphaFoot,betaFoot);
                     else
                     if((int)joint==(int)ZigJointId.RightShoulder ||  (int)joint==(int)ZigJointId.LeftShoulder)
                                 orientation=	DoubleExSmooth(joint,orientation,alphaShoulder,betaShoulder);
                     else
                     if((int)joint==(int)ZigJointId.RightWrist ||  (int)joint==(int)ZigJointId.LeftWrist)
                                 orientation=	DoubleExSmooth(joint,orientation,alphaWrist,betaWrist);
                     else
                     if((int)joint==(int)ZigJointId.RightHand ||  (int)joint==(int)ZigJointId.LeftHand)
                                 orientation=	DoubleExSmooth(joint,orientation,alphaHand,betaHand);
                     else
                     if((int)joint==(int)ZigJointId.Torso )
                                 orientation=	DoubleExSmooth(joint,orientation,alphaSpine,betaSpine);
                    else
                     if((int)joint==(int)ZigJointId.Neck )
                                 orientation=	DoubleExSmooth(joint,orientation,alphaNeck,betaNeck);
                    else
                     if((int)joint==(int)ZigJointId.Head )
                                 orientation=	DoubleExSmooth(joint,orientation,alphaHead,betaHead);

                    }

            Quaternion newRotation = transform.rotation * orientation * initialRotations[(int)joint];
            if (mirror)
            {
                newRotation.y = -newRotation.y;
                newRotation.z = -newRotation.z;
            }

            //  CALLING THE SMOOTHNING FUNCTION

            transforms[(int)joint].rotation = Quaternion.Slerp(transforms[(int)joint].rotation, newRotation, Time.deltaTime * RotationDamping);

            //Debug.Log("rotaion updated " + transforms[(int)joint].rotation.ToString("F4"));// , transforms[(int)joint].rotation.y,transforms[(int)joint].rotation.z );							Debug.Log ("Outputing");
            Debug.Log ("joingID: " + joint.ToString());

            if((int)joint ==TrackedRightElbow)
            {
            Debug.Log ("Outputing");
            System.IO.File.AppendAllText("C:/Users/prp/Desktop/TrackedRightElbow.txt",transforms[(int)joint].rotation.ToString("F4")+"\n");
            //System.IO.File.AppendAllText("C:/Users/prp/Desktop/a.txt","\n");
        }
            if((int)joint ==TrackedLeftHip)
            {
            Debug.Log ("Outputing");
            System.IO.File.AppendAllText("C:/Users/prp/Desktop/TrackedLeftFoot.txt",transforms[(int)joint].rotation.ToString("F4")+"\n");
            //System.IO.File.AppendAllText("C:/Users/prp/Desktop/a.txt","\n");
        }

        }
    }