Browse Source

make visualization move first then steps

Kenkart 2 years ago
parent
commit
b5a2aa50a6
1 changed files with 18 additions and 8 deletions
  1. 18 8
      Assets/Scripts/PlayerReplay.cs

+ 18 - 8
Assets/Scripts/PlayerReplay.cs

@@ -156,8 +156,10 @@ public class PlayerReplay : MonoBehaviour
             GameObject body = new GameObject("Recorded Body " + i);
             for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
             {
-                // Skip if head joint
-                if (jt == Kinect.JointType.Head)
+                // Skip these joints
+                if (jt == Kinect.JointType.Head || jt == Kinect.JointType.ThumbLeft || jt == Kinect.JointType.ThumbRight
+                        || jt == Kinect.JointType.HandLeft || jt == Kinect.JointType.HandRight
+                        || jt == Kinect.JointType.HandTipLeft || jt == Kinect.JointType.HandTipRight)
                     continue;
 
                 // Create GameObject cubes for joints
@@ -165,10 +167,10 @@ public class PlayerReplay : MonoBehaviour
                 LineRenderer lr = jointObj.AddComponent<LineRenderer>();
                 lr.positionCount = 2;
                 lr.material = boneMaterial;
-                lr.startWidth = 0.3f;
-                lr.endWidth = 0.3f;
+                lr.startWidth = 0.05f;
+                lr.endWidth = 0.05f;
 
-                jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
+                jointObj.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
                 jointObj.name = jt.ToString();
                 JointsData jd = newJointsData[i];
                 jointObj.transform.position = new Vector3(jd.jointsPositionsX[(int)jt], jd.jointsPositionsY[(int)jt], jd.jointsPositionsZ[(int)jt]);
@@ -178,8 +180,11 @@ public class PlayerReplay : MonoBehaviour
             // Connect the joints with LineRenderer
             for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
             {
-                // Skip if dictionary not contains the joint or neck joint
-                if (!_BoneMap.ContainsKey(jt) || jt == Kinect.JointType.Neck)
+                // Skip if dictionary not contains the joint or other these joints
+                if (!_BoneMap.ContainsKey(jt) || jt == Kinect.JointType.Neck
+                    || jt == Kinect.JointType.ThumbLeft || jt == Kinect.JointType.ThumbRight
+                        || jt == Kinect.JointType.HandLeft || jt == Kinect.JointType.HandRight
+                        || jt == Kinect.JointType.HandTipLeft || jt == Kinect.JointType.HandTipRight)
                     continue;
 
                 Transform jointObj = body.transform.Find(jt.ToString());
@@ -229,7 +234,12 @@ public class PlayerReplay : MonoBehaviour
             } else
             {
                 waitTime += 3;
-                
+
+                // TODO: Show visualization first (need to test)
+                StartCoroutine(Visualize(jointsDataSeries, recordingTimesSeries));
+
+
+                // Show visualization steps
                 Visualizer_FadeInSeries body = Instantiate(vfis) as Visualizer_FadeInSeries;
                 body.transform.parent = gameObject.transform;
                 body.SetData(jointsDataSeries, recordingTimesSeries);