Exemple #1
0
    // Token: 0x0600009F RID: 159 RVA: 0x00007788 File Offset: 0x00005988
    public bool ComputeIntersection(global::UnityEngine.Vector3 source, global::UnityEngine.Vector3 direction, ref global::SteamVR_Overlay.IntersectionResults results)
    {
        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool flag = overlay == null;
        bool result;

        if (flag)
        {
            result = false;
        }
        else
        {
            global::Valve.VR.VROverlayIntersectionParams_t vroverlayIntersectionParams_t = default(global::Valve.VR.VROverlayIntersectionParams_t);
            vroverlayIntersectionParams_t.eOrigin       = global::SteamVR_Render.instance.trackingSpace;
            vroverlayIntersectionParams_t.vSource.v0    = source.x;
            vroverlayIntersectionParams_t.vSource.v1    = source.y;
            vroverlayIntersectionParams_t.vSource.v2    = -source.z;
            vroverlayIntersectionParams_t.vDirection.v0 = direction.x;
            vroverlayIntersectionParams_t.vDirection.v1 = direction.y;
            vroverlayIntersectionParams_t.vDirection.v2 = -direction.z;
            global::Valve.VR.VROverlayIntersectionResults_t vroverlayIntersectionResults_t = default(global::Valve.VR.VROverlayIntersectionResults_t);
            bool flag2 = !overlay.ComputeOverlayIntersection(this.handle, ref vroverlayIntersectionParams_t, ref vroverlayIntersectionResults_t);
            if (flag2)
            {
                result = false;
            }
            else
            {
                results.point    = new global::UnityEngine.Vector3(vroverlayIntersectionResults_t.vPoint.v0, vroverlayIntersectionResults_t.vPoint.v1, -vroverlayIntersectionResults_t.vPoint.v2);
                results.normal   = new global::UnityEngine.Vector3(vroverlayIntersectionResults_t.vNormal.v0, vroverlayIntersectionResults_t.vNormal.v1, -vroverlayIntersectionResults_t.vNormal.v2);
                results.UVs      = new global::UnityEngine.Vector2(vroverlayIntersectionResults_t.vUVs.v0, vroverlayIntersectionResults_t.vUVs.v1);
                results.distance = vroverlayIntersectionResults_t.fDistance;
                result           = true;
            }
        }
        return(result);
    }
 // Token: 0x060000E9 RID: 233 RVA: 0x0000A130 File Offset: 0x00008330
 private void Update()
 {
     foreach (int num in this.controllerIndices)
     {
         global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
         bool flag = instance && this.point && this.pointer;
         if (flag)
         {
             global::SteamVR_Utils.RigidTransform transform = global::SteamVR_Controller.Input(num).transform;
             this.pointer.transform.localPosition = transform.pos;
             this.pointer.transform.localRotation = transform.rot;
             global::SteamVR_Overlay.IntersectionResults intersectionResults = default(global::SteamVR_Overlay.IntersectionResults);
             bool flag2 = instance.ComputeIntersection(transform.pos, transform.rot * global::UnityEngine.Vector3.forward, ref intersectionResults);
             bool flag3 = flag2;
             if (flag3)
             {
                 this.point.transform.localPosition = intersectionResults.point;
                 this.point.transform.localRotation = global::UnityEngine.Quaternion.LookRotation(intersectionResults.normal);
             }
         }
         else
         {
             foreach (global::Valve.VR.EVRButtonId evrbuttonId in this.buttonIds)
             {
                 bool pressDown = global::SteamVR_Controller.Input(num).GetPressDown(evrbuttonId);
                 if (pressDown)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press down");
                 }
                 bool pressUp = global::SteamVR_Controller.Input(num).GetPressUp(evrbuttonId);
                 if (pressUp)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press up");
                     bool flag4 = evrbuttonId == global::Valve.VR.EVRButtonId.k_EButton_Axis1;
                     if (flag4)
                     {
                         global::SteamVR_Controller.Input(num).TriggerHapticPulse(500, global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                         this.PrintControllerStatus(num);
                     }
                 }
                 bool press = global::SteamVR_Controller.Input(num).GetPress(evrbuttonId);
                 if (press)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId);
                 }
             }
             foreach (global::Valve.VR.EVRButtonId buttonId in this.axisIds)
             {
                 bool touchDown = global::SteamVR_Controller.Input(num).GetTouchDown(buttonId);
                 if (touchDown)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch down");
                 }
                 bool touchUp = global::SteamVR_Controller.Input(num).GetTouchUp(buttonId);
                 if (touchUp)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch up");
                 }
                 bool touch = global::SteamVR_Controller.Input(num).GetTouch(buttonId);
                 if (touch)
                 {
                     global::UnityEngine.Vector2 axis = global::SteamVR_Controller.Input(num).GetAxis(buttonId);
                     string text = "axis: ";
                     global::UnityEngine.Vector2 vector = axis;
                     global::UnityEngine.Debug.Log(text + vector.ToString());
                 }
             }
         }
     }
 }