Dear All I am trying to use a script I found to track the XYZ coordinates whie the hand moves through space and output them to a simple txt file. The examples I found here dont really represent what I am trying to do so if anyone could look over this code and tell me why I might be getting an error that would be awesome!
import System;
import System.IO;
var fileFolder : String;
var fileName: String;
var saveFrequency : float;
private var saveString : String;
//call the function "Save Location" from as soon as the script starts running and every "saveFrequency" seconds afterward
InvokeRepeating("SaveLocation", 0, saveFrequency);
function Awake() {
//create folder if it doesn't exist yet
if (!Directory.Exists (fileFolder)) {
Directory.CreateDirectory (fileFolder);
}
}
function SaveLocation() {
//add time since program start and position and rotation of the recorded object to the string
var objPos = Time.time + " " + transform.position.ToString() + " " + transform.rotation.ToString();
//keep adding a new line with information for each save
saveString = saveString + "\n" + objPos;
}
function Update() {
//save to hard disk when pressing A
if (Input.GetKeyDown(KeyCode.A)){
Save.SaveTextFile(fileFolder+fileName+".txt", saveString);
}
}