Skip to content

Commit

Permalink
Fix distance and speed recording
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory LAFON committed Apr 25, 2023
1 parent 9dd2e26 commit b297a0c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
10 changes: 10 additions & 0 deletions Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -22474,6 +22474,11 @@ PrefabInstance:
propertyPath: PREPTIME
value:
objectReference: {fileID: 848178240}
- target: {fileID: 114231484636407250, guid: f81c4d7a4cbdfb24e8da9814932dc770,
type: 3}
propertyPath: Rotation
value:
objectReference: {fileID: 428329997}
- target: {fileID: 114231484636407250, guid: f81c4d7a4cbdfb24e8da9814932dc770,
type: 3}
propertyPath: BeeScreen
Expand All @@ -22494,6 +22499,11 @@ PrefabInstance:
propertyPath: screenText
value:
objectReference: {fileID: 8400000, guid: d359d7a9c24da1a469879371323cb78c, type: 2}
- target: {fileID: 114231484636407250, guid: f81c4d7a4cbdfb24e8da9814932dc770,
type: 3}
propertyPath: Translation
value:
objectReference: {fileID: 447326791}
- target: {fileID: 114231484636407250, guid: f81c4d7a4cbdfb24e8da9814932dc770,
type: 3}
propertyPath: IN_port_name
Expand Down
18 changes: 9 additions & 9 deletions Assets/Src/ConditionningRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ private Timer
private Timer Trial_timer;// duration of the trial
private Timer US_Timer;// Amount of time to give the US

private bool Stim_On = false;
private int Repetition; // numbre of repetition of the line
private int Test; // Is the line a test or not
private int PreTest; // Is the line a Pretest or not
Expand Down Expand Up @@ -338,16 +337,19 @@ private Timer
}

private void Trial_action_on() {
Dist += Mathf.Sqrt( Mathf.Pow( gameObject.transform.position.x - Tmp_X,
2 ) + Mathf.Pow( gameObject.transform.position.z - Tmp_Z, 2 ) );

Speed = Mathf.Sqrt( Mathf.Pow( gameObject.transform.position.x - Tmp_X,
2 ) + Mathf.Pow( gameObject.transform.position.z - Tmp_Z, 2 ) ) / Time.deltaTime;
float pos_x = -World_controller.transform.localPosition.x;
float pos_z = -World_controller.transform.localPosition.z;

Dist += Mathf.Sqrt( Mathf.Pow( pos_x - Tmp_X, 2 ) + Mathf.Pow( pos_z - Tmp_Z, 2 ) );

Speed = Mathf.Sqrt( Mathf.Pow( pos_x - Tmp_X, 2 ) + Mathf.Pow( pos_z - Tmp_Z,
2 ) ) / Time.deltaTime;

gameObject.GetComponent<walking>().Distance.text = ( Dist * 100 ).ToString();

Tmp_X = gameObject.transform.position.x;
Tmp_Z = gameObject.transform.position.z;
Tmp_X = pos_x;
Tmp_Z = pos_z;

if( Check_choice() ) {
bool is_ignored = Xpmanager.Experiment_data.Textures_to_ignore.Contains( Centered_object );
Expand Down Expand Up @@ -500,8 +502,6 @@ private Timer
}
}
}

Stim_On = show;
}

private void Set_values( bool startup = false ) {
Expand Down
2 changes: 1 addition & 1 deletion Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"com.unity.analytics": "3.6.12",
"com.unity.collab-proxy": "1.17.7",
"com.unity.ide.rider": "3.0.16",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.visualstudio": "2.0.18",
"com.unity.ide.vscode": "1.2.5",
"com.unity.purchasing": "4.5.1",
"com.unity.render-pipelines.universal": "12.1.8",
Expand Down
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.16",
"version": "2.0.18",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down

0 comments on commit b297a0c

Please sign in to comment.