VR position tracking

Using code tags properly Please read that post.

Afterwards, I would have a look at the tutorials page, pick one and go through it. Rinse and repeat.
https://unity3d.com/learn/tutorials

I believe your question is that you want to periodically save the player’s position until he reaches a certain position.
Your code currently registers one and only one position called during awake :

rowDataTemp[2] = Player.transform.position.ToString("G4");

If you want to save the position at different times you need to actually save the position at a… different… time.

Here’s a sample code which should be easy to modify :

public class SavePlayPos : MonoBehaviour
    {
        public bool recording = true;
        public Transform recordTransform; // The transform's position you want to save

        private Dictionary<float, Vector3> positions = new Dictionary<float, Vector3>();
        private float delay = .5f;

        private void Start()
        {
            StartCoroutine(RecordPosition());
        }

        private IEnumerator RecordPosition()
        {
            while (recording)
            {
                positions.Add(Time.time, recordTransform.position); // Record the position at this current time

                yield return new WaitForSeconds(delay); // Wait X seconds before recording the position again
            }
            // Done recording
            // Save the dict to a csv or any other format with any other code
        }
    }

Anyways, I would suggest starting with the basics.

2 Likes