Browse Source

WIP add joints to list not working

Kenkart 2 years ago
parent
commit
1c380256eb
2 changed files with 9 additions and 2 deletions
  1. 9 1
      Assets/Scripts/PlayerReplay.cs
  2. 0 1
      Assets/Scripts/ViveInput.cs

+ 9 - 1
Assets/Scripts/PlayerReplay.cs

@@ -44,7 +44,13 @@ public class PlayerReplay : MonoBehaviour
 
     public void AddJoints()
     {
+        // TODO: still not working, all elements are replaced with new added array
         jointsSequence.Add(joints);
+
+        foreach(Transform[] t in jointsSequence)
+        {
+            Debug.Log("debug: " + t[0].position);
+        }
     }
 
     public void Save()
@@ -78,11 +84,12 @@ public class PlayerReplay : MonoBehaviour
         // Show joints every 2 seconds
         WaitForSeconds wait = new WaitForSeconds(2);
         List<JointsData> jointsData = data.jointsDataSequence;
+        int counter = 0;
 
         foreach(JointsData jd in jointsData)
         {
             // Create GameObject body
-            GameObject body = new GameObject("Recorded Body");
+            GameObject body = new GameObject("Recorded Body " + counter);
             for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
             {
                 // skip if head joint
@@ -121,6 +128,7 @@ public class PlayerReplay : MonoBehaviour
                 lr.SetPosition(1, targetJoint.localPosition);
             }
 
+            counter++;
             yield return wait;
         }
     }

+ 0 - 1
Assets/Scripts/ViveInput.cs

@@ -26,7 +26,6 @@ public class ViveInput : MonoBehaviour
             playerReplay.AddJoints();
         }
 
-        // TODO: need to test
         if (teleport.GetStateDown(SteamVR_Input_Sources.Any))
         {
             playerReplay.Save();