private static void checkPush(LinkedList<Skeleton> moves)
{
if (!canGesture)
return;
Joint prevJoint = new Joint();
Joint firstJoint = moves.First<Skeleton>().Joints[JointType.HandLeft];
Joint lastJoint = moves.Last<Skeleton>().Joints[JointType.HandLeft];
foreach (Skeleton skeleton in moves)
{
Joint joint = skeleton.Joints[JointType.HandLeft];
//Checking if pushing
if (prevJoint.Position.Z == 0.0)
{
prevJoint = joint;
continue;
}
if (prevJoint.Position.Z > joint.Position.Z)
{
prevJoint = joint;
continue;
}
return;
}
if ((Math.Abs(lastJoint.Position.Z - firstJoint.Position.Z) > .15) &&
Math.Abs(lastJoint.Position.X - firstJoint.Position.X) < .18 &&
Math.Abs(lastJoint.Position.Y - firstJoint.Position.Y) < .18)
{
canGesture = false;
lastGesture = "Pushed";
pushed = true;
canGestureTimer.Start();
}
}