Beispiel #1
0
 public void DetectHeightMapSensor()
 {
     Hierarchy.Bone bone = Source.FindBone("Hips");
     if (bone == null)
     {
         Debug.Log("Could not find height map sensor.");
     }
     else
     {
         HeightMapSensor = bone.Index;
     }
 }
Beispiel #2
0
 public void DetectDepthMapSensor()
 {
     Hierarchy.Bone bone = Source.FindBone("Head");
     if (bone == null)
     {
         Debug.Log("Could not find depth map sensor.");
     }
     else
     {
         DepthMapSensor = bone.Index;
     }
 }
Beispiel #3
0
 public void SampleTransformations(MotionData reference, params string[] bones)
 {
     if (reference == null)
     {
         Debug.Log("No reference specified.");
         return;
     }
     foreach (string bone in bones)
     {
         Hierarchy.Bone self  = Source.FindBone(bone);
         Hierarchy.Bone other = reference.Source.FindBone(bone);
         if (self == null || other == null)
         {
             Debug.Log("No mapping found for resampling bone " + bone + ".");
         }
         else
         {
             foreach (Frame frame in Frames)
             {
                 frame.Transformations[self.Index] = reference.SampleSourceTransformation(frame.Timestamp.Normalize(0f, GetTotalTime(), 0f, reference.GetTotalTime()), other.Index);
             }
         }
     }
 }
Beispiel #4
0
 public void DetectSymmetry()
 {
     Symmetry = new int[Source.Bones.Length];
     for (int i = 0; i < Source.Bones.Length; i++)
     {
         string name = Source.Bones[i].Name;
         if (name.Contains("Left"))
         {
             int            pivot = name.IndexOf("Left");
             Hierarchy.Bone bone  = Source.FindBone(name.Substring(0, pivot) + "Right" + name.Substring(pivot + 4));
             if (bone == null)
             {
                 Debug.Log("Could not find mapping for " + name + ".");
             }
             else
             {
                 Symmetry[i] = bone.Index;
             }
         }
         else if (name.Contains("Right"))
         {
             int            pivot = name.IndexOf("Right");
             Hierarchy.Bone bone  = Source.FindBone(name.Substring(0, pivot) + "Left" + name.Substring(pivot + 5));
             if (bone == null)
             {
                 Debug.Log("Could not find mapping for " + name + ".");
             }
             else
             {
                 Symmetry[i] = bone.Index;
             }
         }
         else if (name.StartsWith("L") && char.IsUpper(name[1]))
         {
             Hierarchy.Bone bone = Source.FindBone("R" + name.Substring(1));
             if (bone == null)
             {
                 Debug.Log("Could not find mapping for " + name + ".");
             }
             else
             {
                 Symmetry[i] = bone.Index;
             }
         }
         else if (name.StartsWith("R") && char.IsUpper(name[1]))
         {
             Hierarchy.Bone bone = Source.FindBone("L" + name.Substring(1));
             if (bone == null)
             {
                 Debug.Log("Could not find mapping for " + name + ".");
             }
             else
             {
                 Symmetry[i] = bone.Index;
             }
         }
         else
         {
             Symmetry[i] = i;
         }
     }
 }