ComputeIntersection() public method

public ComputeIntersection ( Vector3 source, Vector3 direction, IntersectionResults &results ) : bool
source Vector3
direction Vector3
results IntersectionResults
return bool
Exemplo n.º 1
0
 private void Update()
 {
     foreach (int num in this.controllerIndices)
     {
         SteamVR_Overlay instance = SteamVR_Overlay.instance;
         if (instance && this.point && this.pointer)
         {
             SteamVR_Utils.RigidTransform transform = SteamVR_Controller.Input(num).transform;
             this.pointer.transform.localPosition = transform.pos;
             this.pointer.transform.localRotation = transform.rot;
             SteamVR_Overlay.IntersectionResults intersectionResults = default(SteamVR_Overlay.IntersectionResults);
             bool flag = instance.ComputeIntersection(transform.pos, transform.rot * Vector3.forward, ref intersectionResults);
             if (flag)
             {
                 this.point.transform.localPosition = intersectionResults.point;
                 this.point.transform.localRotation = Quaternion.LookRotation(intersectionResults.normal);
             }
         }
         else
         {
             foreach (EVRButtonId evrbuttonId in this.buttonIds)
             {
                 if (SteamVR_Controller.Input(num).GetPressDown(evrbuttonId))
                 {
                     Debug.Log(evrbuttonId + " press down");
                 }
                 if (SteamVR_Controller.Input(num).GetPressUp(evrbuttonId))
                 {
                     Debug.Log(evrbuttonId + " press up");
                     if (evrbuttonId == EVRButtonId.k_EButton_Axis1)
                     {
                         SteamVR_Controller.Input(num).TriggerHapticPulse(500, EVRButtonId.k_EButton_Axis0);
                         this.PrintControllerStatus(num);
                     }
                 }
                 if (SteamVR_Controller.Input(num).GetPress(evrbuttonId))
                 {
                     Debug.Log(evrbuttonId);
                 }
             }
             foreach (EVRButtonId evrbuttonId2 in this.axisIds)
             {
                 if (SteamVR_Controller.Input(num).GetTouchDown(evrbuttonId2))
                 {
                     Debug.Log(evrbuttonId2 + " touch down");
                 }
                 if (SteamVR_Controller.Input(num).GetTouchUp(evrbuttonId2))
                 {
                     Debug.Log(evrbuttonId2 + " touch up");
                 }
                 if (SteamVR_Controller.Input(num).GetTouch(evrbuttonId2))
                 {
                     Vector2 axis = SteamVR_Controller.Input(num).GetAxis(evrbuttonId2);
                     Debug.Log("axis: " + axis);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void Update()
 {
     foreach (int controllerIndex in this.controllerIndices)
     {
         SteamVR_Overlay instance = SteamVR_Overlay.instance;
         if ((bool)((Object)instance) && (bool)((Object)this.point) && (bool)((Object)this.pointer))
         {
             SteamVR_Utils.RigidTransform transform = SteamVR_Controller.Input(controllerIndex).transform;
             this.pointer.transform.localPosition = transform.pos;
             this.pointer.transform.localRotation = transform.rot;
             SteamVR_Overlay.IntersectionResults results = new SteamVR_Overlay.IntersectionResults();
             if (instance.ComputeIntersection(transform.pos, transform.rot * Vector3.forward, ref results))
             {
                 this.point.transform.localPosition = results.point;
                 this.point.transform.localRotation = Quaternion.LookRotation(results.normal);
             }
         }
         else
         {
             foreach (EVRButtonId buttonId in this.buttonIds)
             {
                 if (SteamVR_Controller.Input(controllerIndex).GetPressDown(buttonId))
                 {
                     Debug.Log((object)(((int)buttonId).ToString() + " press down"));
                 }
                 if (SteamVR_Controller.Input(controllerIndex).GetPressUp(buttonId))
                 {
                     Debug.Log((object)(((int)buttonId).ToString() + " press up"));
                     if (buttonId == EVRButtonId.k_EButton_Axis1)
                     {
                         SteamVR_Controller.Input(controllerIndex).TriggerHapticPulse((ushort)500, EVRButtonId.k_EButton_Axis0);
                         this.PrintControllerStatus(controllerIndex);
                     }
                 }
                 if (SteamVR_Controller.Input(controllerIndex).GetPress(buttonId))
                 {
                     Debug.Log((object)buttonId);
                 }
             }
             foreach (EVRButtonId axisId in this.axisIds)
             {
                 if (SteamVR_Controller.Input(controllerIndex).GetTouchDown(axisId))
                 {
                     Debug.Log((object)(((int)axisId).ToString() + " touch down"));
                 }
                 if (SteamVR_Controller.Input(controllerIndex).GetTouchUp(axisId))
                 {
                     Debug.Log((object)(((int)axisId).ToString() + " touch up"));
                 }
                 if (SteamVR_Controller.Input(controllerIndex).GetTouch(axisId))
                 {
                     Debug.Log((object)("axis: " + (object)SteamVR_Controller.Input(controllerIndex).GetAxis(axisId)));
                 }
             }
         }
     }
 }