コード例 #1
0
    bool DetectGripTransition(ref HandData hand)
    {
        if (hand.state == HandState.Grip && hand.gripObject == null)
        {
            TransitionToState(ref hand, HandState.Neutral);

            return(true);
        }

        if (hand.input.handTrigger >= GripThreshold)
        {
            if (hand.pointObject && hand.pointObjectFrame + PointStickyFrames >= context.GetRenderFrame())
            {
                NetworkInfo networkInfo = hand.pointObject.GetComponent <NetworkInfo>();

                if (networkInfo.CanLocalPlayerGrabCube(hand.gripInputStartFrame))
                {
                    AttachToHand(ref hand, hand.pointObject);

                    TransitionToState(ref hand, HandState.Grip);

                    return(true);
                }
            }
        }

        return(false);
    }