Exemplo n.º 1
0
        public void TrackSkeleton(Body body, string uniqueKinectId)
        {
            if (body.IsTracked)
            {
                var skeletonTrack = new SkeletonTrack(body.TrackingId);

                foreach (var joint in body.Joints)
                {
                    if ((int)joint.Key < 13 || (int)joint.Key > 20)                        // exclude joints below the waist
                    {
                        var orientation = body.JointOrientations[joint.Key].Orientation.W; // not sure if JointOrientation XYZ are same/different than Joint XYZ
                        skeletonTrack.Add(joint.Value, orientation);
                    }
                }

                skeletonTrack.KinectDeviceId = uniqueKinectId;
                skeletonTrack.Location       = new LocationCoordinates
                {
                    Latitude  = float.Parse(ConfigurationManager.AppSettings["LocationLatitude"]),
                    Longitude = float.Parse(ConfigurationManager.AppSettings["LocationLongitutde"])
                };

                _eventHub.SendMessageToEventHub(skeletonTrack);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Exports all meshes in the archive. If the mesh belongs to a model, it exports additional information
        /// </summary>
        private void ExportCharacterMeshes()
        {
            foreach (WldFragment meshFragment in _fragmentTypeDictionary[0x36])
            {
                if (!(meshFragment is Mesh mesh))
                {
                    continue;
                }

                // Find the model reference
                ModelReference actorReference = null;

                bool isMainModel = FindModelReference(mesh.Name.Split('_')[0] + "_ACTORDEF", out actorReference);

                if (!isMainModel && !FindModelReference(mesh.Name.Substring(0, 3) + "_ACTORDEF", out actorReference))
                {
                    // _logger.LogError("Cannot export character model: " + mesh.Name);
                    continue;
                }

                // If this is a skeletal model, shift the values to get the default pose (things like boats have a skeleton but no references)
                if (actorReference.SkeletonReferences.Count != 0)
                {
                    SkeletonTrack skeleton = actorReference.SkeletonReferences[0].SkeletonTrack;

                    if (skeleton == null)
                    {
                        continue;
                    }

                    mesh.ShiftSkeletonValues(skeleton, skeleton.Skeleton[0], vec3.Zero, 0);
                }

                ExportCharacterMesh(mesh, isMainModel);
            }
        }