Example #1
0
    void Update()
    {
        OVRInput.Controller activeController = OVRInput.GetActiveController();

        data.Length = 0;
        byte recenterCount = OVRInput.GetControllerRecenterCount();

        data.AppendFormat("RecenterCount: {0}\n", recenterCount);

        byte battery = OVRInput.GetControllerBatteryPercentRemaining();

        data.AppendFormat("Battery: {0}\n", battery);

        float framerate = OVRPlugin.GetAppFramerate();

        data.AppendFormat("Framerate: {0:F2}\n", framerate);

        string activeControllerName = activeController.ToString();

        data.AppendFormat("Active: {0}\n", activeControllerName);

        string connectedControllerNames = OVRInput.GetConnectedControllers().ToString();

        data.AppendFormat("Connected: {0}\n", connectedControllerNames);

        data.AppendFormat("PrevConnected: {0}\n", prevConnected);

        controllers.Update();
        controllers.AppendToStringBuilder(ref data);

        prevConnected = connectedControllerNames;

        Vector3 rot = OVRInput.GetLocalControllerRotation(activeController).eulerAngles;

        if (rot.x > 180f)
        {
            rot.x -= 360f;
        }
        if (rot.y > 180f)
        {
            rot.y -= 360f;
        }
        if (rot.z > 180f)
        {
            rot.z -= 360f;
        }

        data.AppendFormat("Orientation: ({0:F2}, {1:F2}, {2:F2})\n", rot.x, rot.y, rot.z);
        //Quaternion rot = OVRInput.GetLocalControllerRotation(activeController);
        //data.AppendFormat("Orientation: ({0:F2}, {1:F2}, {2:F2})\n", rot.x, rot.y, rot.z, rot.w);

        Vector3 angVel = OVRInput.GetLocalControllerAngularVelocity(activeController);

        data.AppendFormat("AngVel: ({0:F2}, {1:F2}, {2:F2})\n", angVel.x, angVel.y, angVel.z);

        Vector3 angAcc = OVRInput.GetLocalControllerAngularAcceleration(activeController);

        data.AppendFormat("AngAcc: ({0:F2}, {1:F2}, {2:F2})\n", angAcc.x, angAcc.y, angAcc.z);

        Vector3 pos = OVRInput.GetLocalControllerPosition(activeController);

        data.AppendFormat("Position: ({0:F2}, {1:F2}, {2:F2})\n", pos.x, pos.y, pos.z);

        Vector3 vel = OVRInput.GetLocalControllerVelocity(activeController);

        data.AppendFormat("Vel: ({0:F2}, {1:F2}, {2:F2})\n", vel.x, vel.y, vel.z);

        Vector3 acc = OVRInput.GetLocalControllerAcceleration(activeController);

        data.AppendFormat("Acc: ({0:F2}, {1:F2}, {2:F2})\n", acc.x, acc.y, acc.z);

        Vector2 primaryTouchpad = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);

        data.AppendFormat("PrimaryTouchpad: ({0:F2}, {1:F2})\n", primaryTouchpad.x, primaryTouchpad.y);

        Vector2 secondaryTouchpad = OVRInput.Get(OVRInput.Axis2D.SecondaryTouchpad);

        data.AppendFormat("SecondaryTouchpad: ({0:F2}, {1:F2})\n", secondaryTouchpad.x, secondaryTouchpad.y);

        float indexTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger);

        data.AppendFormat("PrimaryIndexTriggerAxis1D: ({0:F2})\n", indexTrigger);

        float handTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger);

        data.AppendFormat("PrimaryHandTriggerAxis1D: ({0:F2})\n", handTrigger);

        for (int i = 0; i < monitors.Count; i++)
        {
            monitors[i].Update();
            monitors[i].AppendToStringBuilder(ref data);
        }

        if (uiText != null)
        {
            uiText.text = data.ToString();
        }
    }
Example #2
0
    void Update()
    {
        data.Length = 0;

        OVRInput.Controller activeController = OVRInput.GetActiveController();

        string activeControllerName = activeController.ToString();

        data.AppendFormat("Active: {0}\n", activeControllerName);

        string connectedControllerNames = OVRInput.GetConnectedControllers().ToString();

        data.AppendFormat("Connected: {0}\n", connectedControllerNames);

        data.AppendFormat("PrevConnected: {0}\n", prevConnected);

        controllers.Update();
        controllers.AppendToStringBuilder(ref data);
        prevConnected = connectedControllerNames;

        Vector3 pos = OVRInput.GetLocalControllerPosition(activeController);

        data.AppendFormat("Position: ({0:F2}, {1:F2}, {2:F2})\n", pos.x, pos.y, pos.z);

        Quaternion rot = OVRInput.GetLocalControllerRotation(activeController);

        data.AppendFormat("Orientation: ({0:F2}, {1:F2}, {2:F2}, {3:F2})\n", rot.x, rot.y, rot.z, rot.w);

        data.AppendFormat("HandTrackingEnabled: {0}\n", OVRPlugin.GetHandTrackingEnabled());

        bool result_hs_LH = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandLeft, ref hs_LH);

        data.AppendFormat("LH HS Query Res: {0}\n", result_hs_LH);
        data.AppendFormat("LH HS Status: {0}\n", hs_LH.Status);
        data.AppendFormat("LH HS Pose: {0}\n", hs_LH.RootPose);
        data.AppendFormat("LH HS HandConf: {0}\n", hs_LH.HandConfidence);

        bool result_hs_RH = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandRight, ref hs_RH);

        data.AppendFormat("RH HS Query Res: {0}\n", result_hs_RH);
        data.AppendFormat("RH HS Status: {0}\n", hs_RH.Status);
        data.AppendFormat("RH HS Pose: {0}\n", hs_RH.RootPose);
        data.AppendFormat("RH HS HandConf: {0}\n", hs_RH.HandConfidence);

        data.AppendFormat("LH Skel Query Res: {0}\n", result_skel_LH);
        data.AppendFormat("LH Skel Type: {0}\n", skel_LH.Type);
        data.AppendFormat("LH Skel NumBones: {0}\n", skel_LH.NumBones);

        data.AppendFormat("RH Skel Query Res: {0}\n", result_skel_RH);
        data.AppendFormat("RH Skel Type: {0}\n", skel_RH.Type);
        data.AppendFormat("RH Skel NumBones: {0}\n", skel_RH.NumBones);

        data.AppendFormat("LH Mesh Query Res: {0}\n", result_mesh_LH);
        data.AppendFormat("LH Mesh Type: {0}\n", mesh_LH.Type);
        data.AppendFormat("LH Mesh NumVers: {0}\n", mesh_LH.NumVertices);

        data.AppendFormat("RH Mesh Query Res: {0}\n", result_mesh_RH);
        data.AppendFormat("RH Mesh Type: {0}\n", mesh_RH.Type);
        data.AppendFormat("RH Mesh NumVers: {0}\n", mesh_RH.NumVertices);

        for (int i = 0; i < monitors.Count; i++)
        {
            monitors[i].Update();
            monitors[i].AppendToStringBuilder(ref data);
        }

        if (uiText != null)
        {
            uiText.text = data.ToString();
        }
    }