public static LeapTransform GetTestPoseLeftHandTransform(TestHandPose pose)
        {
            LeapTransform transform = LeapTransform.Identity;

            switch (pose)
            {
            case TestHandPose.HeadMountedA:
                transform.rotation    = angleAxis(180 * Constants.DEG_TO_RAD, Vector.Forward);
                transform.translation = new Vector(80f, 120f, 0f);
                break;

            case TestHandPose.HeadMountedB:
                transform.rotation    = Quaternion.Euler(30F, -10F, -20F).ToLeapQuaternion();
                transform.translation = new Vector(220f, 270f, 130f);
                break;

            case TestHandPose.DesktopModeA:
                transform.rotation = angleAxis(0f * Constants.DEG_TO_RAD, Vector.Forward)
                                     .Multiply(angleAxis(-90f * Constants.DEG_TO_RAD, Vector.Right))
                                     .Multiply(angleAxis(180f * Constants.DEG_TO_RAD, Vector.Up));
                transform.translation = new Vector(120f, 0f, -170f);
                break;

            case TestHandPose.ScreenTop:
                transform.rotation = angleAxis(0 * Constants.DEG_TO_RAD, Vector.Forward)
                                     .Multiply(angleAxis(140 * Constants.DEG_TO_RAD, Vector.Right))
                                     .Multiply(angleAxis(0 * Constants.DEG_TO_RAD, Vector.Up));
                transform.translation = new Vector(-120f, 20f, -380f);
                transform.scale       = new Vector(1, 1, 1);
                break;
            }
            return(transform);
        }
 /// <summary>
 /// Returns a test Leap Hand object in the argument TestHandPose.
 /// </summary>
 public static Hand MakeTestHand(bool isLeft, TestHandPose pose,
                                 int frameId       = 0, int handId = 0,
                                 UnitType unitType = UnitType.LeapUnits)
 {
     return(MakeTestHand(isLeft, GetTestPoseLeftHandTransform(pose),
                         frameId, handId,
                         unitType));
 }
示例#3
0
        public static LeapTransform GetTestPoseLeftHandTransform(TestHandPose pose)
        {
            LeapTransform transform = LeapTransform.Identity;

            switch (pose)
            {
            case TestHandPose.PoseA:
                transform.rotation    = AngleAxis(180 * Constants.DEG_TO_RAD, Vector.Forward);
                transform.translation = new Vector(80f, 120f, 0f);
                break;

            case TestHandPose.PoseB:
                transform.rotation    = Quaternion.Euler(30F, -10F, -20F).ToLeapQuaternion();
                transform.translation = new Vector(220f, 270f, 130f);
                break;
            }
            return(transform);
        }
        /// <summary>
        /// Creates a test Frame that contains two Hands (by default). You can also
        /// optionally specify a TestHandPose to produce a frame with a different test pose.
        /// </summary>
        public static Frame MakeTestFrame(int frameId,
                                          bool includeLeftHand  = true,
                                          bool includeRightHand = true,
                                          TestHandPose handPose = TestHandPose.HeadMountedA,
                                          UnitType unitType     = UnitType.LeapUnits)
        {
            var testFrame = new Frame(frameId, 0, 120.0f,
                                      new List <Hand>());

            if (includeLeftHand)
            {
                testFrame.Hands.Add(MakeTestHand(true, handPose, frameId, 10, unitType));
            }
            if (includeRightHand)
            {
                testFrame.Hands.Add(MakeTestHand(false, handPose, frameId, 20, unitType));
            }

            return(testFrame);
        }
示例#5
0
 /// <summary>
 /// Returns a test Leap Hand object in the argument pose position and rotation from the hand controller.
 /// </summary>
 public static Hand MakeTestHand(bool isLeft, TestHandPose pose, int frameId = 0, int handId = 0)
 {
     return(MakeTestHand(isLeft, GetTestPoseLeftHandTransform(pose), frameId, handId));
 }