示例#1
0
        //-------------------------------------------------
        protected override void OnHandHoverBegin(Hand hand)
        {
            base.OnHandHoverBegin(hand);
            bool showHint = true;

            // "Catch" the throwable by holding down the interaction button instead of pressing it.
            // Only do this if the throwable is moving faster than the prescribed threshold speed,
            // and if it isn't attached to another hand
            if (!attached && parameters.catchingSpeedThreshold != -1)
            {
                float catchingThreshold = parameters.catchingSpeedThreshold * SteamVR_Utils.GetLossyScale(Player.instance.transform);

                bool grabbing = Player.instance.input_manager.GetGrip(hand);

                if (grabbing)
                {
                    if (rb.velocity.magnitude >= catchingThreshold)
                    {
                        hand.AttachGrabbable(this);
                        showHint = false;
                    }
                }
            }

            if (showHint)
            {
                Player.instance.input_manager.ShowGrabHint(hand);
            }
        }
示例#2
0
        //-------------------------------------------------
        protected override void HandHoverUpdate(Hand hand)
        {
            base.HandHoverUpdate(hand);

            bool grabbing = Player.instance.input_manager.GetGripDown(hand);

            if (grabbing)
            {
                hand.AttachGrabbable(this);
                Player.instance.input_manager.HideGrabHint(hand);
            }
        }