Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Boolean SwitchGenre()
- {
- Vector2 right = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.ElbowRight);
- Vector2 left = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.ElbowLeft);
- Vector2 hipCenter = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.HipCenter);
- Vector2 hipLeft = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.HipLeft);
- Vector2 head = SkeletonData.GetVector2Absolute(Microsoft.Kinect.JointType.Head);
- float distCenter = Math.Abs(right.X - hipCenter.X);
- bool handAtHip = false;
- float tol = 20;
- if (Math.Abs(left.X - hipLeft.X) <= 100 && Math.Abs(left.Y - hipLeft.Y) <= 70 && Math.Abs(hipCenter.Y - right.Y) >= 60)
- {
- handAtHip = true;
- }
- //Console.WriteLine("left x:" + Math.Abs(left.X - hipLeft.X) + ", left Y:" + Math.Abs(left.Y - hipLeft.Y) + " right hand y: " + Math.Abs(hipCenter.Y - left.Y));
- // Console.WriteLine("befor" + distCenter);
- if (!swipeParts[0] && handAtHip && distCenter >= 140)
- {
- //Console.WriteLine("start" + distCenter);
- swipeParts[0] = true;
- return false;
- }
- if (swipeParts[0] && !swipeParts[1] && handAtHip && distCenter <= 10)
- {
- //Console.WriteLine("middle" + distCenter);
- swipeParts[1] = true;
- return false;
- }
- if (swipeParts[0] && swipeParts[1] && !swipeParts[2] && handAtHip && distCenter >= 140)
- {
- swipeParts[2] = true;
- matrixMode = true;
- fireSwipe();
- return true;
- }
- else
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement