示例#1
0
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                // Trigger was just pressed
                lastHandProjected = ComputeToTransformProjected(hand.hoverSphereTransform);

                if (hoverLock)
                {
                    hand.HoverLock(GetComponent <Interactable>());
                    handHoverLocked = hand;
                }

                driving = true;

                ComputeAngle(hand);
                UpdateAll();

                ControllerButtonHints.HideButtonHint(hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
            }
            else if (hand.GetStandardInteractionButtonUp())
            {
                // Trigger was just released
                if (hoverLock)
                {
                    hand.HoverUnlock(GetComponent <Interactable>());
                    handHoverLocked = null;
                }
            }
            else if (driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == GetComponent <Interactable>())
            {
                ComputeAngle(hand);
                UpdateAll();
            }
        }
示例#2
0
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         this.lastHandProjected = this.ComputeToTransformProjected(hand.hoverSphereTransform);
         if (this.hoverLock)
         {
             hand.HoverLock(base.GetComponent <Interactable>());
             this.handHoverLocked = hand;
         }
         this.driving = true;
         this.ComputeAngle(hand);
         this.UpdateAll();
         ControllerButtonHints.HideButtonHint(hand, new EVRButtonId[]
         {
             EVRButtonId.k_EButton_Axis1
         });
     }
     else if (hand.GetStandardInteractionButtonUp())
     {
         if (this.hoverLock)
         {
             hand.HoverUnlock(base.GetComponent <Interactable>());
             this.handHoverLocked = null;
         }
     }
     else if (this.driving && hand.GetStandardInteractionButton() && hand.hoveringInteractable == base.GetComponent <Interactable>())
     {
         this.ComputeAngle(hand);
         this.UpdateAll();
     }
 }
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                steering = true;
                hand.HoverLock(GetComponent <Interactable>());

                initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform);
                sampleCount          = 0;
                mappingChangeRate    = 0.0f;
            }

            if (hand.GetStandardInteractionButtonUp())
            {
                steering = false;
                hand.HoverUnlock(GetComponent <Interactable>());

                CalculateMappingChangeRate();
            }

            if (hand.GetStandardInteractionButton())
            {
                UpdateLinearMapping(hand.transform);
            }
        }
        //-------------------------------------------------
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                hand.HoverLock(GetComponent <Interactable> ());

                initialMappingOffset = linearMapping.value - CalculateLinearMapping(hand.transform);
                sampleCount          = 0;
                mappingChangeRate    = 0.0f;
                onAttachedToHand.Invoke();
            }

            if (hand.GetStandardInteractionButtonUp())
            {
                hand.HoverUnlock(GetComponent <Interactable> ());

                CalculateMappingChangeRate();
                onDetachedFromHand.Invoke();
            }

            if (hand.GetStandardInteractionButton())
            {
                UpdateLinearMapping(hand.transform);
            }
        }
示例#5
0
        private void HandHoverUpdate(Hand hand)
        {
            if (hand.GetStandardInteractionButtonDown())
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    hand.HoverLock(GetComponent <Interactable>());

                    hand.AttachObject(gameObject, attachmentFlags);
                }
            }
            else if (hand.GetStandardInteractionButtonUp())
            {
                hand.DetachObject(gameObject);

                hand.HoverUnlock(GetComponent <Interactable>());
            }
        }
示例#6
0
 // Token: 0x06005CDE RID: 23774 RVA: 0x00206C54 File Offset: 0x00205054
 private void HandHoverUpdate(Hand hand)
 {
     if (hand.GetStandardInteractionButtonDown())
     {
         hand.HoverLock(base.GetComponent <Interactable>());
         this.initialMappingOffset = this.linearMapping.value - this.CalculateLinearMapping(hand.transform);
         this.sampleCount          = 0;
         this.mappingChangeRate    = 0f;
     }
     if (hand.GetStandardInteractionButtonUp())
     {
         hand.HoverUnlock(base.GetComponent <Interactable>());
         this.CalculateMappingChangeRate();
     }
     if (hand.GetStandardInteractionButton())
     {
         this.UpdateLinearMapping(hand.transform);
     }
 }
示例#7
0
        private void HandHoverUpdate(Hand hand)
        {
            UnityEngine.Debug.Log("Hover");
            if (hand.GetStandardInteractionButtonDown() || ((hand.controller != null) && hand.controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject != gameObject)
                {
                    UnityEngine.Debug.Log("Attatch");
                    //Orienting to hand
                    this.transform.position = hand.transform.position;
                    this.transform.rotation = Quaternion.Euler(hand.transform.rotation.eulerAngles + grabOrientation);

                    //Locking for detatchment
                    hand.HoverLock(GetComponent <Interactable>());
                    hand.AttachObject(gameObject, attatchmentFlags);

                    //Used for velocity gathering
                    isActive = true;

                    //Connecting to hand with Joint
                    //CreateHandJoint();
                    //handJoint.connectedBody = hand.GetComponent<Rigidbody>();
                }
            }
            else if (hand.GetStandardInteractionButtonUp() || ((hand.controller != null) && hand.controller.GetPressUp(Valve.VR.EVRButtonId.k_EButton_Grip)))
            {
                if (hand.currentAttachedObject == gameObject)
                {
                    UnityEngine.Debug.Log("Detatch");
                    hand.DetachObject(gameObject);

                    hand.HoverUnlock(GetComponent <Interactable> ());

                    isActive = false;

                    //Disconnecting handJoint
                    //Destroy(handJoint);
                }
            }
        }
示例#8
0
    // Update is called once per frame
    void Update()
    {
        if (lController && lController.GetStandardInteractionButtonDown())
        {
            LGlove.SetBool("IsGrabing", true);
        }
        else if (lController && lController.GetStandardInteractionButtonUp())
        {
            LGlove.SetBool("IsGrabing", false);
        }

        if (rController && rController.GetStandardInteractionButtonDown())
        {
            RGlove.GetComponent <Animator>().SetBool("IsGrabing", true);
        }
        else if (rController && rController.GetStandardInteractionButtonUp())
        {
            RGlove.GetComponent <Animator>().SetBool("IsGrabing", false);
        }

        //grab ();
    }
示例#9
0
    void FixedUpdate()
    {
        //SteamVR_Controller.Device device = SteamVR_Controller.Input((int)rightController.index);
        //SteamVR_Controller.Device device = rightController.controller;

        //if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger)) {
        if (rightController.GetStandardInteractionButtonDown())
        {
            dragging = false;
            Ray        ray = new Ray(rightController.transform.position, rightController.transform.forward);
            RaycastHit hit;
            if (myCollider.Raycast(ray, out hit, 100))
            {
                dragging = true;
            }
        }
        //if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Trigger)) dragging = false;
        if (rightController.GetStandardInteractionButtonUp())
        {
            dragging = false;
        }
        if (rightController.GetStandardInteractionButton())
        {
            // if (dragging && device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) {
            Ray        ray = new Ray(rightController.transform.position, rightController.transform.forward);
            RaycastHit hit;
            if (myCollider.Raycast(ray, out hit, 100))
            {
                var point = hit.point;  //Camera.main.ScreenToWorldPoint(Input.mousePosition);
                //point = myCollider.ClosestPointOnBounds(point);
                SetThumbPosition(point);
                BoxCollider boxCollider = GetComponent <BoxCollider>();
                SendMessage("OnDrag", Vector3.one - (thumb.localPosition - minBound.localPosition) / boxCollider.size.x);
            }
        }
    }
 // ---------- ---------- ---------- ---------- ----------
 public bool CheckOffInput()
 {
     //m_hand.controller.TriggerHapticPulse();
     return(m_hand.GetStandardInteractionButtonUp());
 }