Example #1
0
 private void Move_MoveRightHandUp(object sender, MoveEventArgs e)
 {
     circle.Opacity = 0.5;
 }
Example #2
0
 private void Move_MoveRightHandDown(object sender, MoveEventArgs e)
 {
     circle.Opacity = 1;
 }
Example #3
0
 private void Move_MoveRightHandNavigating(object sender, MoveEventArgs e)
 {
     Canvas.SetLeft(circle, e.X);
     Canvas.SetTop(circle, e.Y);
 }
Example #4
0
        private static void CheckMoves(Skeleton skeleton)
        {
            var positions = skeleton.Joints.Select(j => j.Position).ToArray();
            var newShoulderCenter = positions[(int)JointType.ShoulderCenter];

            if (Math.Abs(newShoulderCenter.X - shoulderCenter.X) > 0.05)
                shoulderCenter = newShoulderCenter;

            hipCenter = positions[(int)JointType.HipCenter];
            handRight = positions[(int)JointType.HandRight];
            handLeft = positions[(int)JointType.HandLeft];

            trackingID = skeleton.TrackingID;

            rightHandDifference = shoulderCenter.Z - handRight.Z;
            leftHandDifference = shoulderCenter.Z - handLeft.Z;

            // Convert the X and Y positions to a position on the screen.
            var leftX = Math.Round(ConvertX(handLeft.X + 0.45f), 0);
            var leftY = Math.Round(ConvertY(handLeft.Y), 0);
            var leftZ = handLeft.Z;

            if (leftX < 0) leftX = 0;
            if (leftY < 0) leftY = 0;

            leftArgs = new MoveEventArgs(trackingID, leftX, leftY, handLeft.Z);

            var rightX = Math.Round(ConvertX(handRight.X + 0.15f), 0);
            var rightY = Math.Round(ConvertY(handRight.Y), 0);
            var rightZ = handRight.Z;

            if (rightX < 0) rightX = 0;
            if (rightY < 0) rightY = 0;

            rightArgs = new MoveEventArgs(trackingID, rightX, rightY, handRight.Z);

            // Check all moves.
            CheckRightHandMove();
            CheckLeftHandMove();

            CheckScale();
            CheckRotate();
            CheckTranslate();

            if (Transform != null)
                CheckTransform();
        }