Last active
June 22, 2017 08:39
-
-
Save JotaroS/be0081280d43df7908745756d4014d8e to your computer and use it in GitHub Desktop.
Logs data of transform/rotation of the Gameobject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DataLogger : MonoBehaviour { | |
private StreamWriter sw; | |
private FileInfo fi; | |
private DateTime date; | |
// Use this for initialization | |
void Start () { | |
date = DateTime.Now; | |
} | |
// Update is called once per frame | |
void Update () { | |
string str; | |
string format = "yyyy-MM-dd-HH-mm-ss"; | |
string filename = "/data/" + date.ToString (format) + ".csv"; | |
fi = new FileInfo(Application.dataPath + filename); | |
str = this.gameObject + "," + (transform.position.x) + "," +(transform.position.y) + "," + (transform.position.z)+","+ transform.rotation.x +","+ transform.rotation.y +","+ transform.rotation.z +","+ transform.rotation.w ; | |
sw = fi.AppendText(); | |
sw.WriteLine(str); | |
sw.Flush(); | |
sw.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment