public override void OnProcessSkeleton(Skeleton skeleton) { // Check if joints hit anything foreach (JointType type in joints) { SkeletonPoint pt = pointConverter.ConvertPoint(skeleton.Joints[type].Position); if (type == JointType.HandLeft) { //DebugHelper.GetInstance().LogMessage(this.HitRectangles[1].ToString() + " - " + pt.ToReadableString()); } int rectIdx = HitTestRects(pt); if (rectIdx > -1) { Vector velocity = ComputeJointVelocity(type); // Max velocity if (Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y) > 20) { if (RectHit != null) { RectHit(this, new RectHitEventArgs() { Joint = type, HitVelocity = velocity, RectIdx = rectIdx }); } } } } }
private SkeletonPoint GetPoint(Skeleton skel, JointType type) { return(pointConverter.ConvertPoint(skel.Joints[type].Position)); }