public void AnimateGesture(SimulatedHandPose.GestureId newGesture, float gestureAnimDelta)
        {
            if (!IsSimulated)
            {
                return;
            }

            if (newGesture != SimulatedHandPose.GestureId.None && newGesture != gesture)
            {
                gesture            = newGesture;
                lastGestureAnim    = 0.0f;
                currentGestureAnim = Mathf.Clamp01(gestureAnimDelta);
            }
            else
            {
                lastGestureAnim    = currentGestureAnim;
                currentGestureAnim = Mathf.Clamp01(currentGestureAnim + gestureAnimDelta);
            }

            SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture);

            if (gesturePose != null)
            {
                pose.TransitionTo(gesturePose, lastGestureAnim, currentGestureAnim);
            }

            // Pinch is a special gesture that triggers the Select and TriggerPress input actions
            IsPinching = (gesture == SimulatedHandPose.GestureId.Pinch && currentGestureAnim > 0.9f);
        }
 private SimulatedHandPose.GestureId ToggleGesture(SimulatedHandPose.GestureId gesture)
 {
     if (UnityEngine.Input.GetMouseButtonDown(0))
     {
         return(gesture != profile.LeftMouseHandGesture ? profile.LeftMouseHandGesture : profile.DefaultHandGesture);
     }
     else if (UnityEngine.Input.GetMouseButtonDown(1))
     {
         return(gesture != profile.RightMouseHandGesture ? profile.RightMouseHandGesture : profile.DefaultHandGesture);
     }
     else if (UnityEngine.Input.GetMouseButtonDown(2))
     {
         return(gesture != profile.MiddleMouseHandGesture ? profile.MiddleMouseHandGesture : profile.DefaultHandGesture);
     }
     else
     {
         // 'None' will not change the gesture
         return(SimulatedHandPose.GestureId.None);
     }
 }
        public void Reset(float defaultHandDistance, SimulatedHandPose.GestureId defaultGesture)
        {
            // Start at current mouse position
            Vector3 mousePos = UnityEngine.Input.mousePosition;

            screenPosition = new Vector3(mousePos.x, mousePos.y, defaultHandDistance);

            gesture            = defaultGesture;
            lastGestureAnim    = 1.0f;
            currentGestureAnim = 1.0f;

            SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture);

            if (gesturePose != null)
            {
                pose.Copy(gesturePose);
            }

            handRotateEulerAngles = Vector3.zero;
            jitterOffset          = Vector3.zero;
        }