private Ray3D calibrateDeviceOnePosition(int user, byte device) { UserPrompt.Write("Turning on device " + device); Device.turnOn(device); Thread.Sleep(CALIBRATION_OFFSET_SEC * 1000); Vector3D[] headPoints = new Vector3D[STEADY_SEC * SAMPLES_PER_SEC]; Vector3D[] rightHandPoints = new Vector3D[STEADY_SEC * SAMPLES_PER_SEC]; // Sample the user's hopefully steady hand. SkeletonJointPosition head = new SkeletonJointPosition(); SkeletonJointPosition rightHand = new SkeletonJointPosition(); for (int i = 0; i < STEADY_SEC * SAMPLES_PER_SEC; i++) { head = userGenerator.SkeletonCapability.GetSkeletonJointPosition(user, SkeletonJoint.Head); rightHand = userGenerator.SkeletonCapability.GetSkeletonJointPosition(user, SkeletonJoint.RightHand); headPoints[i] = new Vector3D(head.Position.X, head.Position.Y, head.Position.Z); rightHandPoints[i] = new Vector3D(rightHand.Position.X, rightHand.Position.Y, rightHand.Position.Z); } Thread.Sleep((CALIBRATION_SEC - STEADY_SEC - CALIBRATION_OFFSET_SEC) * 1000); // Take the averages of each side. Vector3D averageHeadPoint = new Vector3D(headPoints.Average(x => x.X), headPoints.Average(x => x.Y), headPoints.Average(x => x.Z)); Vector3D averageRightHandPoint = new Vector3D(rightHandPoints.Average(x => x.X), rightHandPoints.Average(x => x.Y), rightHandPoints.Average(x => x.Z)); UserPrompt.Write("Turning off device " + device); Device.turnOff(device); return new Ray3D(averageHeadPoint, averageRightHandPoint); }