Save continuous x, y and z positions player in csv or txt file

Discussion and help for Easy Save 3
Post Reply
thomaythiers
Posts: 2
Joined: Tue Jun 02, 2020 9:32 pm

Save continuous x, y and z positions player in csv or txt file

Post by thomaythiers »

Hello,

I'm a neuroscience student and I need to save the continous x, y and z data from player direction and rotation, as well as key presses, positions of rocks in a river, and other triggers.

Is this possible with easysave ?

How would you use it to do so (especially for the continuous x,y,z positions)

Best,

Thomas
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Save continuous x, y and z positions player in csv or txt file

Post by Joel »

Hi Thomas,

This is indeed possible. In fact the easiest way to save continuous position to a CSV would be to do the following:

Code: Select all

using UnityEngine;
using System.Collections;

public class SaveContinuous : MonoBehaviour
{
	void FixedUpdate()
	{
		// Create a blank ES3Spreadsheet.
		var sheet = new ES3Spreadsheet();
 
		// Save some values into the spreadsheet.
		sheet.SetCell(0,0, transform.localPosition.x);
		sheet.SetCell(1,0, transform.localPosition.y);
		sheet.SetCell(2,0, transform.localPosition.z);
 
		// Append the row to the existing spreadsheet, or create a new one if it doesn't exist.
		sheet.Save("myData.csv", true);
	}
}
You could also add additional columns to the spreadsheet if necessary representing your other data.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
thomaythiers
Posts: 2
Joined: Tue Jun 02, 2020 9:32 pm

Re: Save continuous x, y and z positions player in csv or txt file

Post by thomaythiers »

Hi Joel,

Thank you so much this is super helpful !!!

Best,

Thomas
Post Reply