コード例 #1
0
        private void CheckIfShouldInteractWithController(VR_ControllerInfo info, bool ignoreDistance)
        {
            float d = ignoreDistance ? 0.0f : GetDistanceToController(info.controller);

            if (d < interactDistance)
            {
                //the button was alredy pressed when the controller enter the grab range?
                if (info.interactionButtonWasPressed)
                {
                    info.interactionButtonWasPressed = info.controller.Input.GetButtonDown(interactButton);

                    if (info.interactionButtonWasPressed)
                    {
                        return;
                    }
                }

                if (info.controller.Input.GetButtonDown(interactButton))
                {
                    info.controller.InteractWithNearesObject();
                    info.interactionButtonWasPressed = true;
                    return;
                }
            }
            else
            {
                info.interactionButtonWasPressed = info.controller.Input.GetButtonDown(interactButton);
            }
        }
コード例 #2
0
        public void ProcessControllerInfoInteraction(VR_ControllerInfo info)
        {
            VR_HandInteractSettings settings = info.controller.ControllerType == VR_ControllerType.Right ? rightHandSettings : leftHandSettings;
            Transform highlightPoint         = info.controller.ControllerType == VR_ControllerType.Right ? HighlightPointRightHand : HighlightPointLeftHand;
            bool      ignoreDistance         = false;

            //if we are trying to do a distance grab using this controller
            if (useDistanceGrab && activeDistanceGrabControllerList != null && activeDistanceGrabControllerList.Count > 0 && activeDistanceGrabControllerList.Contains(info.controller))
            {
                ignoreDistance = true;
            }

            if (settings.canInteract && highlightPoint != null)
            {
                CheckIfShouldInteractWithController(info, ignoreDistance);
            }
        }
コード例 #3
0
 private void CreateControllersInfo()
 {
     rightControllerInfo = new VR_ControllerInfo(VR_Manager.instance.RightController);
     leftControllerInfo  = new VR_ControllerInfo(VR_Manager.instance.LeftController);
 }