Browse Source

fix CSVWriter

Kenkart 2 years ago
parent
commit
4d764a9b3a

+ 2 - 2
Assets/Scripts/CSVWriter.cs

@@ -5,7 +5,7 @@ using UnityEngine;
 
 public static class CSVWriter
 {
-    private static string path = Application.dataPath + "/demo_and_body_positions.csv";
+    private static readonly string path = Application.dataPath + "/demo_and_body_positions.csv";
 
     public static void WriteCSV(List<List<Vector3>> posJointsDemos, List<List<Vector3>> posJointsBodys, List<float> csvTimes)
     {
@@ -28,7 +28,7 @@ public static class CSVWriter
         for (int i = 0; i < posJointsDemos.Count; i++)
         {
             List<Vector3> demo = posJointsDemos[i];
-            List<Vector3> body = posJointsDemos[i];
+            List<Vector3> body = posJointsBodys[i];
 
             string d = "";
             string b = "";

+ 4 - 2
Assets/Scripts/PlayerReplay.cs

@@ -166,8 +166,10 @@ public class PlayerReplay : MonoBehaviour
                 GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
                 LineRenderer lr = jointObj.AddComponent<LineRenderer>();
                 lr.positionCount = 2;
-                lr.material = new Material(Shader.Find("Sprites/Default"));
-                lr.material.color = new Color(1, 0.8f, 0.6f);
+                lr.material = new Material(Shader.Find("Sprites/Default"))
+                {
+                    color = new Color(1, 0.8f, 0.6f)
+                };
                 lr.startWidth = 0.05f;
                 lr.endWidth = 0.05f;
 

+ 1 - 1
Assets/Scripts/SaveSystem.cs

@@ -6,7 +6,7 @@ using UnityEngine;
 
 public static class SaveSystem
 {
-    private static string path = Application.dataPath + "/joints.sav";
+    private static readonly string path = Application.dataPath + "/joints.sav";
 
     public static void Save(List<Vector3[]> jointsSequence, List<float> recordingTimes)
     {

+ 1 - 0
Assets/Scripts/ViveInput.cs

@@ -52,6 +52,7 @@ public class ViveInput : MonoBehaviour
         if (grabGrib.GetStateDown(SteamVR_Input_Sources.Any) && !isPlaying)
         {
             Debug.Log("Loading...");
+            csvTime = 0;
             isPlaying = true;
             playerReplay.Load();
         }