-
Notifications
You must be signed in to change notification settings - Fork 0
/
stickLoggger.cs
41 lines (34 loc) · 1.36 KB
/
stickLoggger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
public class stickLoggger : MonoBehaviour {
// Use this for initialization
private int count;
public Transform lefthand;
public Transform rightHand;
static string logFileName;
string buffer;
void Start () {
count = 0;
buffer = "";
System.DateTime gameStartTime = System.DateTime.Now;
logFileName = "LogHandStick_" + +gameStartTime.Year + "_" + gameStartTime.Month + "_" + gameStartTime.Day + "_" + gameStartTime.Hour + "_" + gameStartTime.Minute + "_" + gameStartTime.Second;
}
// Update is called once per frame
void Update () {
//Debug.Log(count);
count++;
buffer += "[" + Time.time.ToString() + "] " + "left (" + lefthand.position.x + "," + lefthand.position.y + "," + lefthand.position.z + ")" + "\n" + "[" + Time.time.ToString() + "] " + "right(" + rightHand.position.x + "," + rightHand.position.y + "," + rightHand.position.z + ")" + "\n";
if (count == 100) {
printlog();
count = 0;
buffer = "";
}
}
public void printlog()
{
File.AppendAllText("C:/Users/RJ/Desktop/Log_VRPointing/LogForHand/" + logFileName + ".txt", buffer, Encoding.UTF8);
}
}