Exemplo n.º 1
0
 public NuiSkeleton(
     NuiBoneOrientationCollection nboc,
     NuiFrameEdges ce,
     NuiSkeletonPoint p,
     int tid,
     NuiSkeletonTrackingState ts,
     NuiJointCollection j)
 {
     this.boneOrientations = nboc;
     this.ClippedEdges = ce;
     this.Position = p;
     this.TrackingId = tid;
     this.TrackingState = ts;
     this.Joints = j;
 }
Exemplo n.º 2
0
        private void SkeletonImageReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletonFrame.CopySkeletonDataTo(this.mySkeletonData);
                    for(int i = 0; i < mySkeletonData.Length; i++)
                    {
                        Skeleton s = mySkeletonData[i];
                        NuiBoneOrientationCollection nboc = new NuiBoneOrientationCollection();
                        /*
                         * note re: BoneOrientation
                         * Apparently we're supposed to be able to access bone orientation info through the Skeleton.BoneOrientation
                         * property, but I can't seem to do it. When you can do this, uncomment the following code
                         *
                         * BEGIN CODE
                         *
                         * for(JointType j = 0; j < (JointType)s.BoneOrientation.Count; j++)
                         * {
                         *  BoneOrientation b = s.BoneOrientation[j];
                         *  NuiBoneOrientation nb = new NuiBoneOrientation(b.StartJoint, b.EndJoint, b.AbsoluteRotation, b.HierarchicalRotation);
                         *  nboc[(NuiJointType)j] = nb;
                         * }
                         *
                         * END CODE
                         */
                        NuiFrameEdges fe = (NuiFrameEdges)s.ClippedEdges;
                        NuiJointCollection njc = new NuiJointCollection();
                        for (JointType j = 0; j < (JointType)s.Joints.Count; j++)
                        {
                            Joint jt = s.Joints[j];
                            NuiJoint nj = new NuiJoint((NuiJointType)jt.JointType, new NuiSkeletonPoint(jt.Position.X, jt.Position.Y, jt.Position.Z), (NuiJointTrackingState)jt.TrackingState);
                            njc[(NuiJointType)j] = nj;
                        }
                        NuiSkeletonPoint nsp = new NuiSkeletonPoint(s.Position.X, s.Position.Y, s.Position.Z);
                        int trackingId = s.TrackingId;
                        NuiSkeletonTrackingState nts = (NuiSkeletonTrackingState)s.TrackingState;
                        myNuiSkeletonData[i] = new NuiSkeleton(nboc, fe, nsp, trackingId, nts, njc);
                    }

                    skeletonLastModified = System.DateTime.Now.TimeOfDay;
                }
            }
        }
 public NuiBoneOrientationEnumerator(NuiBoneOrientationCollection coll)
 {
     this.collection = coll;
 }