Esempio n. 1
0
        public void UpdateSkeleton(SkeletonFrameData skeletonFrameData, InputSkeletonType inputSkeletonType)
        {
            if (lineRenderer == null)
            {
                Debug.Log("LineRenderer STILL not found!");
            }

            NUIJointType[] currentOrder = new NUIJointType[0];

            if (inputSkeletonType != skeletonType)
            {
                switch (inputSkeletonType)
                {
                case InputSkeletonType.Kinect1_20Joint:
#if UNITY_5_5_OR_NEWER
                    lineRenderer.positionCount = 29;
#else
                    lineRenderer.SetVertexCount(29);
#endif
                    currentOrder = Skeleton20JointOrder;
                    break;

                case InputSkeletonType.Kinect2_25Joint:
#if UNITY_5_5_OR_NEWER
                    lineRenderer.positionCount = 38;
#else
                    lineRenderer.SetVertexCount(38);
#endif
                    currentOrder = Skeleton25JointOrder;
                    break;
                }
            }

            Vector3 pos;
            int     index = 0;

            // don't care about below variables, but they're needed
            Quaternion    q;
            TrackingState ts;

            foreach (NUIJointType njt in currentOrder)
            {
                pos = Vector3.zero;

                skeletonFrameData.GetJointData(njt, out pos, out q, out ts);

                lineRenderer.SetPosition(index, pos);

                index++;
            }
        }
        public static List <MappingProfileMetaData> LoadMetaData(InputSkeletonType inputSkeleton)
        {
            var metaData = new List <MappingProfileMetaData>();

            List <Type> types = CinemaMocapHelper.GetMappingProfiles();

            foreach (Type t in types)
            {
                foreach (MappingProfileAttribute attribute in t.GetCustomAttributes(typeof(MappingProfileAttribute), true))
                {
                    if (attribute.InputSkeleton == inputSkeleton)
                    {
                        metaData.Add(new MappingProfileMetaData(t, attribute));
                    }
                }
            }

            return(metaData);
        }
        public static List <MappingProfile> LoadMappingProfiles(InputSkeletonType inputSkeleton)
        {
            List <MappingProfile> mappingProfiles = new List <MappingProfile>();

            List <Type> types = CinemaMocapHelper.GetMappingProfiles();

            foreach (Type t in types)
            {
                foreach (MappingProfileAttribute attribute in t.GetCustomAttributes(typeof(MappingProfileAttribute), true))
                {
                    if (attribute.InputSkeleton == inputSkeleton)
                    {
                        mappingProfiles.Add(Activator.CreateInstance(t) as MappingProfile);
                    }
                }
            }

            return(mappingProfiles);
        }
 public MappingProfileAttribute(string name, InputSkeletonType inputSkeleton, Type outputProfileType)
 {
     this.name              = name;
     this.inputSkeleton     = inputSkeleton;
     this.outputProfileType = outputProfileType;
 }