예제 #1
0
    public void Reset()
    {
        MotionPlusData data = wiimote.MotionPlus;

        board.transform.rotation = board2.GetComponent <Transform>().rotation;
        wmpOffset = Vector3.zero;
        data.SetZeroValues();
    }
예제 #2
0
    void ZeroOut()
    {
        MotionPlusData data = wiimote.MotionPlus;

        data.SetZeroValues();
        model.rot.rotation           = Quaternion.FromToRotation(model.rot.rotation * GetAccelVector(), Vector3.up) * model.rot.rotation;
        model.rot.rotation           = Quaternion.FromToRotation(model.rot.forward, transform.forward) * model.rot.rotation;
        model.rot.transform.position = new Vector3(0, 1.6f, 1.4f);
    }
예제 #3
0
 private IEnumerator CalibrateMotionPlus()
 {
     if (wmpActivated && wiimote.current_ext == ExtensionController.MOTIONPLUS)
     {
         MotionPlusData data = wiimote.MotionPlus;
         data.SetZeroValues();
         Debug.Log("MotionPlus was calibrated");
     }
     else
     {
         yield return(null);
     }
 }
예제 #4
0
    private void RepositionWiimote()
    {
        if (wmpActivated && wiimote.current_ext == ExtensionController.MOTIONPLUS)
        {
            MotionPlusData data = wiimote.MotionPlus;

            if (data.PitchSlow && data.YawSlow && data.RollSlow)
            {
                Quaternion targetRotation =
                    Quaternion.FromToRotation(transform.rotation * GetAccelVector(), -Vector3.up) * transform.rotation;
                transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, smoothingCoefficient * Time.deltaTime);
            }
        }
    }
예제 #5
0
    void UpdateControls()
    {
        if (wiimote.current_ext == ExtensionController.MOTIONPLUS)
        {
            //Reset wiimote rotation if buttons 1 and 2 are pressed.
            if (wiimote.Button.one && wiimote.Button.two)
            {
                MotionPlusData data = wiimote.MotionPlus;

                //data.SetZeroValues(); PRUEBAS
                model.rot.rotation = Quaternion.FromToRotation(model.rot.rotation * GetAccelVector(), Vector3.up) * model.rot.rotation;
                model.rot.rotation = Quaternion.FromToRotation(model.rot.forward, Vector3.forward) * model.rot.rotation;
            }
        }
    }
예제 #6
0
    public Vector3 WMPVectorStandardized()
    {
        if (!wiimote.wmp_attached)
        {
            return(Vector3.zero);
        }

        Vector3        wmp  = Vector3.zero;
        MotionPlusData data = wiimote.MotionPlus;

        //Debug.Log(data.YawSpeed);
        if (Mathf.Abs(data.YawSpeed) > 60)
        {
            wmp.y = data.YawSpeed / 10;
        }

        return(wmp);
    }
예제 #7
0
    private void ReadMotionPlus()
    {
        if (wmpActivated && wiimote.current_ext == ExtensionController.MOTIONPLUS)
        {
            MotionPlusData data        = wiimote.MotionPlus;
            Vector3        rawRotation = new Vector3(data.PitchSpeed,
                                                     -data.YawSpeed,
                                                     data.RollSpeed);

            //Debug.Log ("raw rotation: " + rawRotation);

            Vector3 rotationDegrees = rawRotation * Time.deltaTime;
            //Debug.Log ("rotationdegrees :" + rotationDegrees);
            Vector3 finalRotation = checkDeadZone(rotationDegrees, detectionThreshold);
            //Debug.Log ("finalRotation :" + finalRotation);

            transform.Rotate(finalRotation, Space.Self);
        }
    }
예제 #8
0
    void OnGUI()
    {
        GUI.Box(new Rect(0, 0, 320, Screen.height), "");

        GUILayout.BeginVertical(GUILayout.Width(300));
        GUILayout.Label("Wiimote Found: " + WiimoteManager.HasWiimote());
        if (GUILayout.Button("Find Wiimote"))
        {
            WiimoteManager.FindWiimotes();
        }

        if (GUILayout.Button("Cleanup"))
        {
            WiimoteManager.Cleanup(wiimote);
            wiimote = null;
        }

        if (wiimote == null)
        {
            return;
        }

        GUILayout.Label("Extension: " + wiimote.current_ext.ToString());

        GUILayout.Label("LED Test:");
        GUILayout.BeginHorizontal();
        for (int x = 0; x < 4; x++)
        {
            if (GUILayout.Button("" + x, GUILayout.Width(300 / 4)))
            {
                wiimote.SendPlayerLED(x == 0, x == 1, x == 2, x == 3);
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Label("Set Report:");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("But/Acc", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL);
        }
        if (GUILayout.Button("But/Ext8", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_EXT8);
        }
        if (GUILayout.Button("B/A/Ext16", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL_EXT16);
        }
        if (GUILayout.Button("Ext21", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_EXT21);
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Request Status Report"))
        {
            wiimote.SendStatusInfoRequest();
        }

        GUILayout.Label("IR Setup Sequence:");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Basic", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.BASIC);
        }
        if (GUILayout.Button("Extended", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.EXTENDED);
        }
        if (GUILayout.Button("Full", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.FULL);
        }
        GUILayout.EndHorizontal();

        GUILayout.Label("WMP Attached: " + wiimote.wmp_attached);
        if (GUILayout.Button("Request Identify WMP"))
        {
            wiimote.RequestIdentifyWiiMotionPlus();
        }
        if ((wiimote.wmp_attached || wiimote.Type == WiimoteType.PROCONTROLLER) && GUILayout.Button("Activate WMP"))
        {
            wiimote.ActivateWiiMotionPlus();
        }
        if ((wiimote.current_ext == ExtensionController.MOTIONPLUS ||
             wiimote.current_ext == ExtensionController.MOTIONPLUS_CLASSIC ||
             wiimote.current_ext == ExtensionController.MOTIONPLUS_NUNCHUCK) && GUILayout.Button("Deactivate WMP"))
        {
            wiimote.DeactivateWiiMotionPlus();
        }

        GUILayout.Label("Calibrate Accelerometer");
        GUILayout.BeginHorizontal();
        for (int x = 0; x < 3; x++)
        {
            AccelCalibrationStep step = (AccelCalibrationStep)x;
            if (GUILayout.Button(step.ToString(), GUILayout.Width(100)))
            {
                wiimote.Accel.CalibrateAccel(step);
            }
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Print Calibration Data"))
        {
            StringBuilder str = new StringBuilder();
            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    str.Append(wiimote.Accel.accel_calib[y, x]).Append(" ");
                }
                str.Append("\n");
            }
            Debug.Log(str.ToString());
        }

        if (wiimote != null && wiimote.current_ext != ExtensionController.NONE)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            GUIStyle bold = new GUIStyle(GUI.skin.button);
            bold.fontStyle = FontStyle.Bold;
            if (wiimote.current_ext == ExtensionController.NUNCHUCK)
            {
                GUILayout.Label("Nunchuck:", bold);
                NunchuckData data = wiimote.Nunchuck;
                GUILayout.Label("Stick: " + data.stick[0] + ", " + data.stick[1]);
                GUILayout.Label("C: " + data.c);
                GUILayout.Label("Z: " + data.z);
            }
            else if (wiimote.current_ext == ExtensionController.CLASSIC)
            {
                GUILayout.Label("Classic Controller:", bold);
                ClassicControllerData data = wiimote.ClassicController;
                GUILayout.Label("Stick Left: " + data.lstick[0] + ", " + data.lstick[1]);
                GUILayout.Label("Stick Right: " + data.rstick[0] + ", " + data.rstick[1]);
                GUILayout.Label("Trigger Left: " + data.ltrigger_range);
                GUILayout.Label("Trigger Right: " + data.rtrigger_range);
                GUILayout.Label("Trigger Left Button: " + data.ltrigger_switch);
                GUILayout.Label("Trigger Right Button: " + data.rtrigger_switch);
                GUILayout.Label("A: " + data.a);
                GUILayout.Label("B: " + data.b);
                GUILayout.Label("X: " + data.x);
                GUILayout.Label("Y: " + data.y);
                GUILayout.Label("Plus: " + data.plus);
                GUILayout.Label("Minus: " + data.minus);
                GUILayout.Label("Home: " + data.home);
                GUILayout.Label("ZL: " + data.zl);
                GUILayout.Label("ZR: " + data.zr);
                GUILayout.Label("D-Up: " + data.dpad_up);
                GUILayout.Label("D-Down: " + data.dpad_down);
                GUILayout.Label("D-Left: " + data.dpad_left);
                GUILayout.Label("D-Right: " + data.dpad_right);
            }
            else if (wiimote.current_ext == ExtensionController.MOTIONPLUS)
            {
                GUILayout.Label("Wii Motion Plus:", bold);
                MotionPlusData data = wiimote.MotionPlus;
                GUILayout.Label("Pitch Speed: " + data.PitchSpeed);
                GUILayout.Label("Yaw Speed: " + data.YawSpeed);
                GUILayout.Label("Roll Speed: " + data.RollSpeed);
                GUILayout.Label("Pitch Slow: " + data.PitchSlow);
                GUILayout.Label("Yaw Slow: " + data.YawSlow);
                GUILayout.Label("Roll Slow: " + data.RollSlow);
                if (GUILayout.Button("Zero Out WMP"))
                {
                    data.SetZeroValues();
                    model.rot.rotation = Quaternion.FromToRotation(model.rot.rotation * GetAccelVector(), Vector3.up) * model.rot.rotation;
                    model.rot.rotation = Quaternion.FromToRotation(model.rot.forward, Vector3.forward) * model.rot.rotation;
                }
                if (GUILayout.Button("Reset Offset"))
                {
                    wmpOffset = Vector3.zero;
                }
                GUILayout.Label("Offset: " + wmpOffset.ToString());
            }
            else if (wiimote.current_ext == ExtensionController.WIIU_PRO)
            {
                GUILayout.Label("Wii U Pro Controller:", bold);
                WiiUProData data = wiimote.WiiUPro;
                GUILayout.Label("Stick Left: " + data.lstick[0] + ", " + data.lstick[1]);
                GUILayout.Label("Stick Right: " + data.rstick[0] + ", " + data.rstick[1]);
                GUILayout.Label("A: " + data.a);
                GUILayout.Label("B: " + data.b);
                GUILayout.Label("X: " + data.x);
                GUILayout.Label("Y: " + data.y);

                GUILayout.Label("D-Up: " + data.dpad_up);
                GUILayout.Label("D-Down: " + data.dpad_down);
                GUILayout.Label("D-Left: " + data.dpad_left);
                GUILayout.Label("D-Right: " + data.dpad_right);

                GUILayout.Label("Plus: " + data.plus);
                GUILayout.Label("Minus: " + data.minus);
                GUILayout.Label("Home: " + data.home);

                GUILayout.Label("L: " + data.l);
                GUILayout.Label("R: " + data.r);
                GUILayout.Label("ZL: " + data.zl);
                GUILayout.Label("ZR: " + data.zr);
            }
            GUILayout.EndScrollView();
        }
        else
        {
            scrollPosition = Vector2.zero;
        }
        GUILayout.EndVertical();
    }
예제 #9
0
    void Update()
    {
        numUp = 0.1f;
        if (!WiimoteManager.HasWiimote())
        {
            return;
        }

        wiimote = WiimoteManager.Wiimotes[0];

        int ret;

        do
        {
            ret = wiimote.ReadWiimoteData();

            if (ret > 0 && wiimote.current_ext == ExtensionController.MOTIONPLUS)
            {
                Vector3 offset = new Vector3(-wiimote.MotionPlus.PitchSpeed,
                                             wiimote.MotionPlus.YawSpeed,
                                             wiimote.MotionPlus.RollSpeed) / 95f;    // Divide by 95Hz (average updates per second from wiimote)
                wmpOffset += offset;

                model.rot.Rotate(offset, Space.Self);
            }
        } while (ret > 0);

        model.a.enabled       = wiimote.Button.a;
        model.b.enabled       = wiimote.Button.b;
        model.one.enabled     = wiimote.Button.one;
        model.two.enabled     = wiimote.Button.two;
        model.d_up.enabled    = wiimote.Button.d_up;
        model.d_down.enabled  = wiimote.Button.d_down;
        model.d_left.enabled  = wiimote.Button.d_left;
        model.d_right.enabled = wiimote.Button.d_right;
        model.plus.enabled    = wiimote.Button.plus;
        model.minus.enabled   = wiimote.Button.minus;
        model.home.enabled    = wiimote.Button.home;


        if (wiimote.Button.a)
        {
            UnityEngine.Debug.Log("El valor de rex es: " + rex);
        }


        //Hace funcionar el nunchuck y el home para reiniciar
        if (wiimote.Button.one)
        {
            /*if (num!=0){
             *  try {
             *      wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL_EXT16);
             *  }catch{
             *      UnityEngine.Debug.Log("Error");
             *  }*/
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL_EXT16);
            num       = 0;
            rex       = true;
            butZ      = true;
            butC      = true;
            calib     = true;
            wmpOffset = Vector3.zero;
        }

        //Calibra el control
        if (wiimote.Button.two && calib)
        {
            //UnityEngine.Debug.Log(wiimote.current_ext);


            MotionPlusData data = wiimote.MotionPlus;

            data.SetZeroValues();
            model.rot.rotation = Quaternion.FromToRotation(model.rot.rotation * GetAccelVector(), Vector3.up) * model.rot.rotation;
            model.rot.rotation = Quaternion.FromToRotation(model.rot.forward, Vector3.forward) * model.rot.rotation;

            wmpOffset = Vector3.zero;
            calib     = false;
        }

        //UnityEngine.Debug.Log("Se oprimio A es: " + wiimote.Button.a);

        //Recargar el control
        if (wiimote.Button.home && rex)
        {
            rex = false;
            OnApplicationQuit();
            //UnityEngine.Debug.Log("?????????");
            WiimoteManager.FindWiimotes();
            num = 1;
        }


        try
        {
            if (wiimote.current_ext != ExtensionController.MOTIONPLUS)
            {
                model.rot.localRotation = initial_rotation;
            }
            if (ir_dots.Length < 4)
            {
                return;
            }

            float[,] ir = wiimote.Ir.GetProbableSensorBarIR();
            for (int i = 0; i < 2; i++)
            {
                float x = (float)ir[i, 0] / 1023f;
                float y = (float)ir[i, 1] / 767f;
                if (x == -1 || y == -1)
                {
                    ir_dots[i].anchorMin = new Vector2(0, 0);
                    ir_dots[i].anchorMax = new Vector2(0, 0);
                }

                ir_dots[i].anchorMin = new Vector2(x, y);
                ir_dots[i].anchorMax = new Vector2(x, y);

                if (ir[i, 2] != -1)
                {
                    int   index = (int)ir[i, 2];
                    float xmin  = (float)wiimote.Ir.ir[index, 3] / 127f;
                    float ymin  = (float)wiimote.Ir.ir[index, 4] / 127f;
                    float xmax  = (float)wiimote.Ir.ir[index, 5] / 127f;
                    float ymax  = (float)wiimote.Ir.ir[index, 6] / 127f;
                    ir_bb[i].anchorMin = new Vector2(xmin, ymin);
                    ir_bb[i].anchorMax = new Vector2(xmax, ymax);
                }
            }

            float[] pointer = wiimote.Ir.GetPointingPosition();
            ir_pointer.anchorMin = new Vector2(pointer[0], pointer[1]);
            ir_pointer.anchorMax = new Vector2(pointer[0], pointer[1]);
        }
        catch
        {
            UnityEngine.Debug.Log("Dio algo");
        }

        /*if (num!=0)
         * {
         *  try { wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL_EXT16);
         *  }
         *  catch
         *  {
         *      UnityEngine.Debug.Log("Error");
         *  }
         *  num = 0;
         * }*/
    }
예제 #10
0
    void OnGUI()
    {
        GUI.Box(new Rect(0, 0, 320, Screen.height), "");

        GUILayout.BeginVertical(GUILayout.Width(300));
        GUILayout.Label("Wiimote Found: " + WiimoteManager.HasWiimote());
        if (GUILayout.Button("Find Wiimote"))
        {
            WiimoteManager.FindWiimotes();
        }

        if (GUILayout.Button("Cleanup"))
        {
            UnityEngine.Debug.Log("Reseteo");
            WiimoteManager.Cleanup(wiimote);
            wiimote = null;
        }

        if (wiimote == null)
        {
            return;
        }

        GUILayout.Label("Extension: " + wiimote.current_ext.ToString());

        GUILayout.Label("LED Test:");
        GUILayout.BeginHorizontal();
        for (int x = 0; x < 4; x++)
        {
            if (GUILayout.Button("" + x, GUILayout.Width(300 / 4)))
            {
                wiimote.SendPlayerLED(x == 0, x == 1, x == 2, x == 3);
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.Label("Set Report:");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("But/Acc", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL);
        }
        if (GUILayout.Button("But/Ext8", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_EXT8);
        }
        if (GUILayout.Button("B/A/Ext16", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_BUTTONS_ACCEL_EXT16);
        }
        if (GUILayout.Button("Ext21", GUILayout.Width(300 / 4)))
        {
            wiimote.SendDataReportMode(InputDataType.REPORT_EXT21);
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Request Status Report"))
        {
            wiimote.SendStatusInfoRequest();
        }

        GUILayout.Label("IR Setup Sequence:");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Basic", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.BASIC);
        }
        if (GUILayout.Button("Extended", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.EXTENDED);
        }
        if (GUILayout.Button("Full", GUILayout.Width(100)))
        {
            wiimote.SetupIRCamera(IRDataType.FULL);
        }
        GUILayout.EndHorizontal();

        GUILayout.Label("WMP Attached: " + wiimote.wmp_attached);
        if (GUILayout.Button("Request Identify WMP"))
        {
            wiimote.RequestIdentifyWiiMotionPlus();
        }
        if ((wiimote.wmp_attached || wiimote.Type == WiimoteType.PROCONTROLLER) && GUILayout.Button("Activate WMP"))
        {
            wiimote.ActivateWiiMotionPlus();
        }

        if ((wiimote.current_ext == ExtensionController.MOTIONPLUS ||
             wiimote.current_ext == ExtensionController.MOTIONPLUS_CLASSIC ||
             wiimote.current_ext == ExtensionController.MOTIONPLUS_NUNCHUCK) && GUILayout.Button("Deactivate WMP"))
        {
            wiimote.DeactivateWiiMotionPlus();
            //OnApplicationQuit();


            //WiimoteManager.Cleanup(wiimote);

            /*wiimote = null;
             * WiimoteManager.FindWiimotes();*/


            /* Debug.Log("entre1");
             *
             * NunchuckData data = wiimote.Nunchuck;
             * GUILayout.Label("Stick: " + data.stick[0] + ", " + data.stick[1]);
             * GUILayout.Label("C: " + data.c);
             * GUILayout.Label("Z: " + data.z);*/
        }
        //UnityEngine.Debug.Log("entre2");
        GUILayout.Label("Calibrate Accelerometer");
        GUILayout.BeginHorizontal();
        for (int x = 0; x < 3; x++)
        {
            AccelCalibrationStep step = (AccelCalibrationStep)x;
            if (GUILayout.Button(step.ToString(), GUILayout.Width(100)))
            {
                wiimote.Accel.CalibrateAccel(step);
            }
        }
        GUILayout.EndHorizontal();

        if (GUILayout.Button("Print Calibration Data"))
        {
            StringBuilder str = new StringBuilder();
            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    str.Append(wiimote.Accel.accel_calib[y, x]).Append(" ");
                }
                str.Append("\n");
            }
            UnityEngine.Debug.Log(str.ToString());
        }

        if (wiimote != null && wiimote.current_ext != ExtensionController.NONE)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            GUIStyle bold = new GUIStyle(GUI.skin.button);
            bold.fontStyle = FontStyle.Bold;
            if (wiimote.current_ext == ExtensionController.NUNCHUCK)
            {
                UnityEngine.Debug.Log(wiimote.current_ext);
                GUILayout.Label("Nunchuck:", bold);
                NunchuckData data = wiimote.Nunchuck;
                GUILayout.Label("Stick: " + data.stick[0] + ", " + data.stick[1]);
                GUILayout.Label("C: " + data.c);
                GUILayout.Label("Z: " + data.z);

                if (data.stick[0] > 120 && data.stick[0] < 220 && data.stick[1] > 70 && data.stick[1] < 210)
                {
                    controlWii.transform.position = new Vector3(controlWii.transform.position.x + numUp, 0f, controlWii.transform.position.z);
                }
                if (data.stick[0] > 20 && data.stick[0] < 120 && data.stick[1] > 63 && data.stick[1] < 209)
                {
                    controlWii.transform.position = new Vector3(controlWii.transform.position.x - numUp, 0f, controlWii.transform.position.z);
                }
                if (data.stick[0] > 48 && data.stick[0] < 186 && data.stick[1] > 140 && data.stick[1] < 235)
                {
                    controlWii.transform.position = new Vector3(controlWii.transform.position.x, 0f, controlWii.transform.position.z + numUp);
                }
                if (data.stick[0] > 50 && data.stick[0] < 192 && data.stick[1] > 30 && data.stick[1] < 140)
                {
                    controlWii.transform.position = new Vector3(controlWii.transform.position.x, 0f, controlWii.transform.position.z - numUp);
                }
                if (data.z && butZ)
                {
                    UnityEngine.Debug.Log("Se oprimio la Z");
                    butZ = false;
                    wiimote.RequestIdentifyWiiMotionPlus();
                }
                if (data.c && butC)
                {
                    UnityEngine.Debug.Log("Se oprimio la C");
                    butC = false;
                    wiimote.ActivateWiiMotionPlus();
                }
            }
            else if (wiimote.current_ext == ExtensionController.CLASSIC)
            {
                GUILayout.Label("Classic Controller:", bold);
                ClassicControllerData data = wiimote.ClassicController;
                GUILayout.Label("Stick Left: " + data.lstick[0] + ", " + data.lstick[1]);
                GUILayout.Label("Stick Right: " + data.rstick[0] + ", " + data.rstick[1]);
                GUILayout.Label("Trigger Left: " + data.ltrigger_range);
                GUILayout.Label("Trigger Right: " + data.rtrigger_range);
                GUILayout.Label("Trigger Left Button: " + data.ltrigger_switch);
                GUILayout.Label("Trigger Right Button: " + data.rtrigger_switch);
                GUILayout.Label("A: " + data.a);
                GUILayout.Label("B: " + data.b);
                GUILayout.Label("X: " + data.x);
                GUILayout.Label("Y: " + data.y);
                GUILayout.Label("Plus: " + data.plus);
                GUILayout.Label("Minus: " + data.minus);
                GUILayout.Label("Home: " + data.home);
                GUILayout.Label("ZL: " + data.zl);
                GUILayout.Label("ZR: " + data.zr);
                GUILayout.Label("D-Up: " + data.dpad_up);
                GUILayout.Label("D-Down: " + data.dpad_down);
                GUILayout.Label("D-Left: " + data.dpad_left);
                GUILayout.Label("D-Right: " + data.dpad_right);
            }
            else if (wiimote.current_ext == ExtensionController.MOTIONPLUS)
            {
                UnityEngine.Debug.Log(wiimote.current_ext);
                GUILayout.Label("Wii Motion Plus:", bold);
                MotionPlusData data = wiimote.MotionPlus;
                GUILayout.Label("Pitch Speed: " + data.PitchSpeed);
                GUILayout.Label("Yaw Speed: " + data.YawSpeed);
                GUILayout.Label("Roll Speed: " + data.RollSpeed);
                GUILayout.Label("Pitch Slow: " + data.PitchSlow);
                GUILayout.Label("Yaw Slow: " + data.YawSlow);
                GUILayout.Label("Roll Slow: " + data.RollSlow);



                if (GUILayout.Button("Zero Out WMP"))
                {
                    data.SetZeroValues();
                    model.rot.rotation = Quaternion.FromToRotation(model.rot.rotation * GetAccelVector(), Vector3.up) * model.rot.rotation;
                    model.rot.rotation = Quaternion.FromToRotation(model.rot.forward, Vector3.forward) * model.rot.rotation;
                }
                if (GUILayout.Button("Reset Offset"))
                {
                    wmpOffset = Vector3.zero;
                }
                GUILayout.Label("Offset: " + wmpOffset.ToString());
            }
            else if (wiimote.current_ext == ExtensionController.WIIU_PRO)
            {
                GUILayout.Label("Wii U Pro Controller:", bold);
                WiiUProData data = wiimote.WiiUPro;
                GUILayout.Label("Stick Left: " + data.lstick[0] + ", " + data.lstick[1]);
                GUILayout.Label("Stick Right: " + data.rstick[0] + ", " + data.rstick[1]);
                GUILayout.Label("A: " + data.a);
                GUILayout.Label("B: " + data.b);
                GUILayout.Label("X: " + data.x);
                GUILayout.Label("Y: " + data.y);

                GUILayout.Label("D-Up: " + data.dpad_up);
                GUILayout.Label("D-Down: " + data.dpad_down);
                GUILayout.Label("D-Left: " + data.dpad_left);
                GUILayout.Label("D-Right: " + data.dpad_right);

                GUILayout.Label("Plus: " + data.plus);
                GUILayout.Label("Minus: " + data.minus);
                GUILayout.Label("Home: " + data.home);

                GUILayout.Label("L: " + data.l);
                GUILayout.Label("R: " + data.r);
                GUILayout.Label("ZL: " + data.zl);
                GUILayout.Label("ZR: " + data.zr);
            }
            else if (wiimote.current_ext == ExtensionController.GUITAR)
            {
                GUILayout.Label("Guitar", bold);
                GuitarData data  = wiimote.Guitar;
                float[]    stick = data.GetStick01();
                GUILayout.Label("Stick: " + stick [0] + ", " + stick [1]);
                GUILayout.Label("Slider: " + (data.has_slider ? Convert.ToString(data.GetSlider01()) : "unsupported"));
                GUILayout.Label("Green: " + data.green);
                GUILayout.Label("Red: " + data.red);
                GUILayout.Label("Yellow: " + data.yellow);
                GUILayout.Label("Blue: " + data.blue);
                GUILayout.Label("Orange: " + data.orange);
                GUILayout.Label("Strum Up: " + data.strum_up);
                GUILayout.Label("Strum Down: " + data.strum_down);
                GUILayout.Label("Minus: " + data.minus);
                GUILayout.Label("Plus: " + data.plus);
                GUILayout.Label("Whammy: " + data.GetWhammy01());
            }
            GUILayout.EndScrollView();
        }
        else
        {
            scrollPosition = Vector2.zero;
        }
        GUILayout.EndVertical();
    }