MPU6050 with arduino and unity

Hi

I would like to and am trying to use a 6DOF MPU6050 to create a basic hand mocap device for use inside unity.

I am reading the YAW PITCH and ROLL, all as standard from the library found here

The thing is, i didnt know what was what with the values, so i altered the arduino sketch from this

#ifdef OUTPUT_READABLE_YAWPITCHROLL
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            Serial.print("ypr\t");
            Serial.print(ypr[0] * 180/M_PI);
            Serial.print("\t");
            Serial.print(ypr[1] * 180/M_PI);
            Serial.print("\t");
            Serial.println(ypr[2] * 180/M_PI);
        #endif

to this

        #ifdef OUTPUT_READABLE_YAWPITCHROLL
            // display Euler angles in degrees
            mpu.dmpGetQuaternion(&q, fifoBuffer);
            mpu.dmpGetGravity(&gravity, &q);
            mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
            Serial.print("|X:");
            Serial.print(ypr[0] * 360/M_PI);
             Serial.print("|Y:");
            Serial.print(ypr[1] * 360/M_PI);
             Serial.print("|Z:");
            Serial.print(ypr[2] * 360/M_PI);
             Serial.println("|");
        #endif

in my c# script for unity, i read these in a basic way, though i know it isnt the most efficient, like this

Data = SP.ReadLine ();
			if ( Data ==  "Initializing I2C devices...")
			{
				SP.WriteLine ("0");
			}
			//SP.DiscardInBuffer ();
			//SP.DiscardOutBuffer ();
			DataList = Data.Split (SEP, System.StringSplitOptions.RemoveEmptyEntries);
			//int count = 0;
			foreach (string s in DataList) {
				string[] ThisData;
				//count++;
				//Debug.Log (count);
				ThisData = s.Split (SEPB, System.StringSplitOptions.RemoveEmptyEntries);
				//Debug.Log (s + " | " +ThisData[0] + " | " +ThisData[1] );
			//	try {
					if (ThisData [0] == "W") {
						w = (float.Parse (ThisData [1]));
					//Debug.Log ("W");
					}
				
					if (ThisData [0] == "X") {
						x = (float.Parse (ThisData [1]));
					//Debug.Log ("X");
					}
				
					if (ThisData [0] == "Y") {
						y = (float.Parse (ThisData [1]));
					//Debug.Log ("Y");
					}
				
					if (ThisData [0] == "Z") {
						z = (float.Parse (ThisData [1]));
					//Debug.Log ("Z");
					}
			//	} catch {
			//	}
			}
transform.rotation = Quaternion.Euler (y, x, z);

When it first starts, i send a character from unity to activate the sensor.

All this, kind of works ok. My issue is, is there a better way to do this. Can i make it more precise.

More importantly, say i turn it upside dow, things start to go odd and it doesnt recreate the rotation properly at all.

I know people have made mocap using this sensor before, i just dont get how.