// Grabs position and oriantation data from camera and accumulated frametime and adds it to POD private void grab_pos_data() { currentSampleTime += Time.deltaTime; if ((counter % rate) == 0) { collectedData.addLookingAtVector(raycaster.getCurrentDirection()); collectedData.addCurrentLocation(raycaster.getCurrentLocation()); collectedData.addFrameTime(currentSampleTime); } }
/* * Function to load Time Event Data from file * Will be used to replay an earlier run from supplied CSV file */ public static void ReadTimeEventData(string fileName, POD pod) { StreamReader sr = new StreamReader(fileName); string readStr = sr.ReadLine(); string[] tempStr; while (readStr != null) { tempStr = readStr.Split(','); Vector3 tempLoc; Vector3 tempLook; tempLook.x = float.Parse(tempStr[0], CultureInfo.InvariantCulture.NumberFormat); tempLook.y = float.Parse(tempStr[1], CultureInfo.InvariantCulture.NumberFormat); tempLook.z = float.Parse(tempStr[2], CultureInfo.InvariantCulture.NumberFormat); tempLoc.x = float.Parse(tempStr[3], CultureInfo.InvariantCulture.NumberFormat); tempLoc.y = float.Parse(tempStr[4], CultureInfo.InvariantCulture.NumberFormat); tempLoc.z = float.Parse(tempStr[5], CultureInfo.InvariantCulture.NumberFormat); pod.addLookingAtVector(tempLook); pod.addCurrentLocation(tempLoc); readStr = sr.ReadLine(); } sr.Close(); }