void stopRecording() { recording = false; recordingIndex++; ioWriter.WriteToFileAsCSV(startTime, "head", recordingIndex, headPositions, headRotations, times); ioWriter.WriteToFileAsCSV(startTime, "left", recordingIndex, controllerLeftPositions, controllerLeftRotations, times); ioWriter.WriteToFileAsCSV(startTime, "right", recordingIndex, controllerRightPositions, controllerRightRotations, times); headPositions.Clear(); headRotations.Clear(); controllerLeftPositions.Clear(); controllerLeftRotations.Clear(); controllerRightPositions.Clear(); controllerRightRotations.Clear(); times.Clear(); timer = 0f; Debug.Log("Written"); }
// Update is called once per frame void Update() { if (recording) { headPositions.Add(head.position); headRotations.Add(head.eulerAngles); controllerLeftPositions.Add(controllerLeft.position); controllerLeftRotations.Add(controllerLeft.eulerAngles); controllerRightPositions.Add(controllerRight.position); controllerRightRotations.Add(controllerRight.eulerAngles); timer += Time.deltaTime; times.Add(timer); } if (Input.GetKeyUp(KeyCode.R)) { if (recording) { recording = false; recordingIndex++; ioWriter.WriteToFileAsCSV(startTime, "head", recordingIndex, headPositions, headRotations, times); ioWriter.WriteToFileAsCSV(startTime, "left", recordingIndex, controllerLeftPositions, controllerLeftRotations, times); ioWriter.WriteToFileAsCSV(startTime, "right", recordingIndex, controllerRightPositions, controllerRightRotations, times); headPositions.Clear(); headRotations.Clear(); controllerLeftPositions.Clear(); controllerLeftRotations.Clear(); controllerRightPositions.Clear(); controllerRightRotations.Clear(); times.Clear(); timer = 0f; Debug.Log("Written"); } else if (!recording) { startTime = System.DateTime.Now; recording = true; } } }
void stopRecording() { recording = false; recordingIndex++; var templater = this.gameObject.GetComponent <templateLoader>(); ioWriter.WriteToFileAsCSV("template", recordingIndex, scores, templater.getTemplateNames()); scores.Clear(); Debug.Log("Written"); }