internal void FillCurrentFrame(MixedRealityPose[] jointsOut)
        {
            ArticulatedHandPose gesturePose = SimulatedArticulatedHandPoses.GetGesturePose(gesture);

            if (gesturePose != null)
            {
                if (gestureBlending > poseBlending)
                {
                    float range      = Mathf.Clamp01(1.0f - poseBlending);
                    float lerpFactor = range > 0.0f ? (gestureBlending - poseBlending) / range : 1.0f;
                    pose.InterpolateOffsets(pose, gesturePose, lerpFactor);
                }
            }
            poseBlending = gestureBlending;

            Vector3 screenPosition = CameraCache.Main.ViewportToScreenPoint(ViewportPosition);
            Vector3 worldPosition  = CameraCache.Main.ScreenToWorldPoint(screenPosition + JitterOffset);

            // Apply rotation relative to the wrist joint
            Quaternion rotationRef   = pose.GetLocalJointPose(TrackedHandJoint.Wrist, handedness).Rotation;
            Quaternion localRotation = Quaternion.Euler(ViewportRotation) * Quaternion.Inverse(rotationRef);

            Quaternion worldRotation = CameraCache.Main.transform.rotation * localRotation;

            pose.ComputeJointPoses(handedness, worldRotation, worldPosition, jointsOut);
        }
 public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(ArticulatedHandPose.GestureId gesture, Handedness handedness, Vector3 worldPosition, Quaternion rotation)
 {
     return((jointsOut) =>
     {
         ArticulatedHandPose gesturePose = ArticulatedHandPose.GetGesturePose(gesture);
         gesturePose.ComputeJointPoses(handedness, rotation, worldPosition, jointsOut);
     });
 }
 public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(ArticulatedHandPose.GestureId gesture, Handedness handedness, Vector3 worldPosition, Quaternion rotation)
 {
     return((jointsOut) =>
     {
         ArticulatedHandPose gesturePose = SimulatedArticulatedHandPoses.GetGesturePose(gesture);
         Quaternion worldRotation = rotation * CameraCache.Main.transform.rotation;
         gesturePose.ComputeJointPoses(handedness, worldRotation, worldPosition, jointsOut);
     });
 }
Ejemplo n.º 4
0
 public static SimulatedHandData.HandJointDataGenerator GenerateHandPose(ArticulatedHandPose.GestureId gesture, Handedness handedness, Vector3 screenPosition)
 {
     return((jointsOut) =>
     {
         ArticulatedHandPose gesturePose = ArticulatedHandPose.GetGesturePose(gesture);
         Quaternion rotation = Quaternion.identity;
         Vector3 position = CameraCache.Main.ScreenToWorldPoint(screenPosition);
         gesturePose.ComputeJointPoses(handedness, rotation, position, jointsOut);
     });
 }
        internal void FillCurrentFrame(MixedRealityPose[] jointsOut)
        {
            ArticulatedHandPose gesturePose = ArticulatedHandPose.GetGesturePose(gesture);

            if (gesturePose != null)
            {
                if (gestureBlending > poseBlending)
                {
                    float range      = Mathf.Clamp01(1.0f - poseBlending);
                    float lerpFactor = range > 0.0f ? (gestureBlending - poseBlending) / range : 1.0f;
                    pose.InterpolateOffsets(pose, gesturePose, lerpFactor);
                }
            }
            poseBlending = gestureBlending;

            Quaternion rotation = Quaternion.Euler(HandRotateEulerAngles);
            Vector3    position = CameraCache.Main.ScreenToWorldPoint(ScreenPosition + JitterOffset);

            pose.ComputeJointPoses(handedness, rotation, position, jointsOut);
        }