public static void processArm(JointTracker hand, JointTracker elbow, out SkeletonPoint output) { output = JointTracker.zeroVec(); double s = JointTracker.slope(JointTracker.vecSubt(hand.position(), elbow.position())); if (s > -.4 && s < .19) { JointTracker.vecAdd(ref output, hand.lastDistance()); } //Console.WriteLine(s); }
public static void sendData() { if (clientS != null) { double s = JointTracker.slope(JointTracker.vecSubt(hand.position(), elbow.position())); bool grab = false; if (s > -1.5 && s < .19) { grab = true; } int handX, handZ; handX = (int)(hand.lastDistance().X *1000000); handZ = (int)(hand.lastDistance().Z *1000000); //Console.WriteLine(handX); byte[] temp = new byte[9]; temp[0] = 0; if (grab) { temp[0] = 0x80; } temp[1] = (byte)(handX); temp[2] = (byte)(handX >> 8); temp[3] = (byte)(handX >> 16); temp[4] = (byte)(handX >> 24); temp[5] = (byte)(handZ); temp[6] = (byte)(handZ >> 8); temp[7] = (byte)(handZ >> 16); temp[8] = (byte)(handZ >> 24); //Console.WriteLine(getBits(temp[4])+getBits(temp[3])+getBits(temp[2])+getBits(temp[1])+handX); if (socketOpen) { try { clientS.Send(temp); } catch (SocketException) { f.setConnectionL("Connection lost, listening on port " + PORT); socketOpen = false; //listenS.Bind(new IPEndPoint(IPAddress.Any, 20736)); listenS.Listen(4); listenS.BeginAccept(new AsyncCallback(OnCallAccept), null); } } } }