Exemple #1
0
    //-------------------------------------------------
    private void PlayPointerHaptic(bool validLocation)
    {
        Debug.LogWarning("PlayPointerHaptic - Teleportation");

        /*
         * if ( pointerHand.controller != null )
         * {
         *      if ( validLocation )
         *      {
         *              pointerHand.controller.TriggerHapticPulse( 800 );
         *      }
         *      else
         *      {
         *              pointerHand.controller.TriggerHapticPulse( 100 );
         *      }
         * } */

        if (pointerHand.PhysicalController != null)
        {
            if (validLocation)
            {
                pointerHand.TriggerHapticPulse(800);
            }
            else
            {
                pointerHand.TriggerHapticPulse(100);
            }
        }
    }
Exemple #2
0
 //-------------------------------------------------
 private void PlayPointerHaptic(bool validLocation)
 {
     if (pointerHand != null)
     {
         if (validLocation)
         {
             pointerHand.TriggerHapticPulse(800);
         }
         else
         {
             pointerHand.TriggerHapticPulse(100);
         }
     }
 }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        float distance = 1000;

        Ray        ray = new Ray(FirePoint.position, transform.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, distance))
        {
            distance = Vector3.Distance(hit.point, FirePoint.position);
        }

        laser.localScale = new Vector3(0.01f, distance / 2f, 0.01f);
        laser.position   = FirePoint.position + transform.forward * distance / 2f;

        if (Hand.Inputs[NVRButtons.Trigger].IsPressed)
        {
            if (Physics.Raycast(FirePoint.position, transform.forward, out hit, distance))
            {
                if (hit.collider.CompareTag("PhobicObject"))
                {
                    Destroy(hit.transform.gameObject);
                }
            }

            Hand.TriggerHapticPulse(500);
        }

        if (Hand.Inputs[NVRButtons.Trigger].PressDown == true)
        {
            laser.GetComponent <MeshRenderer>().material.color = onColor;
        }

        if (Hand.Inputs[NVRButtons.Trigger].PressUp == true)
        {
            laser.GetComponent <MeshRenderer>().material.color = offColor;
        }
    }