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); }
public void ResetGesture() { gestureBlending = 1.0f; SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture); if (gesturePose != null) { pose.Copy(gesturePose); } }
internal void FillCurrentFrame(Vector3[] jointsOut) { SimulatedHandPose gesturePose = SimulatedHandPose.GetGesturePose(gesture); if (gesturePose != null) { pose.TransitionTo(gesturePose, poseBlending, gestureBlending); } poseBlending = gestureBlending; Quaternion rotation = Quaternion.Euler(HandRotateEulerAngles); Vector3 position = CameraCache.Main.ScreenToWorldPoint(ScreenPosition + JitterOffset); pose.ComputeJointPositions(handedness, rotation, position, jointsOut); }
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; }