fix dot distance

This commit is contained in:
Chris Midkiff 2020-05-27 01:49:37 -04:00
parent fa8338a904
commit c101d05ff1
2 changed files with 18 additions and 8 deletions

View File

@ -33,9 +33,10 @@ public class ExperimentController : MonoBehaviour {
#endif #endif
UnityEngine.Debug.Log(platform); UnityEngine.Debug.Log(platform);
string response = ""; string response = "";
UnityEngine.Debug.Log(Application.persistentDataPath);
using (WebClient client = new WebClient()) using (WebClient client = new WebClient())
{ {
string endpoint = "http://do.superpichu.org:5000/" + platform; string endpoint = "http://<URL OF SERVER INSTANCE>" + platform;
response = client.DownloadString(endpoint); response = client.DownloadString(endpoint);
UnityEngine.Debug.Log("Received Response: " + response); UnityEngine.Debug.Log("Received Response: " + response);
} }
@ -72,8 +73,8 @@ public class ExperimentController : MonoBehaviour {
double time = stopwatch.Elapsed.TotalSeconds; double time = stopwatch.Elapsed.TotalSeconds;
stopwatch.Reset(); stopwatch.Reset();
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position); double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position); //double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
SaveSample(angle, distance, time, false); SaveSample(angle, time, false);
} }
if (trialDotIndex < participant.trials[trialIndex].Length) if (trialDotIndex < participant.trials[trialIndex].Length)
{ {
@ -116,8 +117,8 @@ public class ExperimentController : MonoBehaviour {
double time = stopwatch.Elapsed.TotalSeconds; double time = stopwatch.Elapsed.TotalSeconds;
stopwatch.Reset(); stopwatch.Reset();
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position); double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position); //double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
SaveSample(angle, distance, time, true); SaveSample(angle, time, true);
Hide(nextDot); Hide(nextDot);
Show(startDot); Show(startDot);
stopwatch.Start(); stopwatch.Start();
@ -146,11 +147,20 @@ public class ExperimentController : MonoBehaviour {
} }
} }
void SaveSample(double angle, double distance, double time, bool direction) void SaveSample(double angle, double time, bool direction)
{ {
Sample sample = new Sample(); Sample sample = new Sample();
sample.Angle = angle; sample.Angle = angle;
sample.Distance = distance; if(nextDot.name.Contains("Short")){
sample.Distance = 500;
}
else if(nextDot.name.Contains("Medium")){
sample.Distance = 1000;
}
else if(nextDot.name.Contains("Long")){
sample.Distance = 1500;
}
else
sample.Time = time; sample.Time = time;
sample.Direction = direction; sample.Direction = direction;
sample.DotName = nextDot.name; sample.DotName = nextDot.name;

View File

@ -17,6 +17,6 @@ namespace Assets.Scripts
public int TrialIndex { get; set; } public int TrialIndex { get; set; }
public int DotIndex { get; set; } public int DotIndex { get; set; }
public long Timestamp { get; set; } public long Timestamp { get; set; }
public int DotSize = 100; public int DotSize = 100;
} }
} }