Beispiel #1
0
    void Update()
    {
        //oculusPoses.Update();
        //Console.WriteLine(OculusPoses.poseVR);
        //oculusPoses.Head.Position = InputTracking.GetLocalPosition(VRNode.Head);
        //Debug.Log(oculusPoses.headset.Head.Position.x);

        OculusPoses.Update();
        Debug.Log(OculusPoses.poseVR.Head.Position);

        OculusButtons.Update();
        Debug.Log(OculusButtons.touchController.A.state);

        string json = JsonUtility.ToJson(OculusButtons.touchController);

        Debug.Log(json);

        //OVRInput.Update();
        //bool aget = OVRInput.Get(OVRInput.Button.One);
        ////bool agetdown = OVRInput.GetDown(OVRInput);
        ////bool getbutton = OVRInput.GetDown(OVRInput.Button);
        //Vector3 head = InputTracking.GetLocalPosition(VRNode.Head);
        //Vector3 l_hand = InputTracking.GetLocalPosition(VRNode.LeftHand);
        //Vector3 r_hand = InputTracking.GetLocalPosition(VRNode.RightHand);
        //Debug.Log("Head> x:" + head.x.ToString("0.00") + " y:" + head.y.ToString("0.00") + " z:" + head.z.ToString("0.00"));
        //Debug.Log("Left Hand> x:" + l_hand.x.ToString("0.00") + " y:" + l_hand.y.ToString("0.00") + " z:" + l_hand.z.ToString("0.00"));
        //Debug.Log("Right Hand> x:" + r_hand.x.ToString("0.00") + " y:" + r_hand.y.ToString("0.00") + " z:" + r_hand.z.ToString("0.00"));
        ////Debug.Log("getdown: " + agetdown.ToString());
        //Debug.Log("get: " + aget.ToString());
        ////Debug.Log("getbutton: " + getbutton.ToString());
        //Vector3 left = Quaternion.Inverse(InputTracking.GetLocalRotation(VRNode.LeftEye)) * InputTracking.GetLocalPosition(VRNode.LeftEye);
        //Vector3 right = Quaternion.Inverse(InputTracking.GetLocalRotation(VRNode.RightEye)) * InputTracking.GetLocalPosition(VRNode.RightEye);
        //Vector3 leftWorld, rightWorld;
        //Vector3 offset = (left - right) * 0.5f;
        //Matrix4x4 m = cam.cameraToWorldMatrix;
        //leftWorld = m.MultiplyPoint(-offset);
        //rightWorld = m.MultiplyPoint(offset);
        //smallSphere.position = (showInFrontOfLeftEye ? leftWorld : rightWorld) + cam.transform.forward * distanceFromEye;
    }
    public static void Update()
    {
        OVRInput.Update();
        PoseVR newPose = new PoseVR();

        newPose.Head.Position      = InputTracking.GetLocalPosition(VRNode.Head);
        newPose.LeftEye.Position   = InputTracking.GetLocalPosition(VRNode.LeftEye);
        newPose.RightEye.Position  = InputTracking.GetLocalPosition(VRNode.RightEye);
        newPose.CenterEye.Position = InputTracking.GetLocalPosition(VRNode.CenterEye);
        newPose.LeftHand.Position  = InputTracking.GetLocalPosition(VRNode.LeftHand);
        newPose.RightHand.Position = InputTracking.GetLocalPosition(VRNode.RightHand);

        newPose.Head.Orientation      = InputTracking.GetLocalRotation(VRNode.Head);
        newPose.LeftEye.Orientation   = InputTracking.GetLocalRotation(VRNode.LeftEye);
        newPose.RightEye.Orientation  = InputTracking.GetLocalRotation(VRNode.RightEye);
        newPose.CenterEye.Orientation = InputTracking.GetLocalRotation(VRNode.CenterEye);
        newPose.LeftHand.Orientation  = InputTracking.GetLocalRotation(VRNode.LeftHand);
        newPose.RightHand.Orientation = InputTracking.GetLocalRotation(VRNode.RightHand);

        OculusButtons.Update();
        newPose.Buttons = OculusButtons.touchController;

        poseVR = newPose;
    }