Commit 9c80c572 authored by Danial KordModanlou's avatar Danial KordModanlou

new balancing car + little data saver

parent d663e669
......@@ -2,3 +2,5 @@
/.vs
/Library
/Logs
*.csv
*.csv.meta
......@@ -34,6 +34,8 @@ public class DataSaver : MonoBehaviour
private String curentName;
public static int checkPoint = 1;
private bool newLineAdded = true;
private int lastCheckPoint = 0;
// public static Action<String,Transform> OnCheckPoint;
private bool stable = false;
......@@ -129,8 +131,22 @@ public class DataSaver : MonoBehaviour
rowDataTemp[10] = "None";
rowDataTemp[11] = "None";
}
string newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}", rowDataTemp[0], rowDataTemp[1], rowDataTemp[2], rowDataTemp[3],rowDataTemp[4],
rowDataTemp[5], rowDataTemp[6], rowDataTemp[7], rowDataTemp[8], rowDataTemp[9], rowDataTemp[10], rowDataTemp[11],checkPoint);
string newLine = null;
if (lastCheckPoint != checkPoint)
{
newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}", rowDataTemp[0], rowDataTemp[1], rowDataTemp[2], rowDataTemp[3],rowDataTemp[4],
rowDataTemp[5], rowDataTemp[6], rowDataTemp[7], rowDataTemp[8], rowDataTemp[9], rowDataTemp[10], rowDataTemp[11],"****");
}
else
{
newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}", rowDataTemp[0], rowDataTemp[1], rowDataTemp[2], rowDataTemp[3],rowDataTemp[4],
rowDataTemp[5], rowDataTemp[6], rowDataTemp[7], rowDataTemp[8], rowDataTemp[9], rowDataTemp[10], rowDataTemp[11]);
}
timePassed = 0;
csv.AppendLine(newLine);
......@@ -172,6 +188,10 @@ public class DataSaver : MonoBehaviour
csv.AppendLine(newLine2);
newLineAdded = true;
}
else
{
lastCheckPoint = checkPoint;
}
File.AppendAllText(filePath, csv.ToString());
}
}
......
......@@ -16,6 +16,9 @@ public class Suspension : MonoBehaviour
Rigidbody m_rigidbody;
public bool setSus;
[Range(0.001f, 100)]
public float divider = 10f;
// Start is called before the first frame update
void Start()
{
......@@ -44,9 +47,9 @@ public class Suspension : MonoBehaviour
if(spring.targetPosition > 0 && setSus)
{
wc.suspensionDistance = wc.sprungMass * Physics.gravity.magnitude / (spring.targetPosition * spring.spring);
wc.suspensionDistance = wc.sprungMass * Physics.gravity.magnitude / (spring.targetPosition * spring.spring * divider);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment