Skip to content

Commit d5c2da6

Browse files
committed
Improve perceptible density of both stimuli
Additionally, options for minimum dot lifetime and maximum dot lifetime have been added to the JSON file
1 parent 40b08bb commit d5c2da6

15 files changed

Lines changed: 287 additions & 297 deletions

Assets/Scenes/AttentionExperiment.unity

Lines changed: 228 additions & 203 deletions
Large diffs are not rendered by default.

Assets/Scenes/StimulusScene.unity

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ PrefabInstance:
126126
m_ObjectHideFlags: 0
127127
serializedVersion: 2
128128
m_Modification:
129-
m_TransformParent: {fileID: 0}
129+
m_TransformParent: {fileID: 1174472515}
130130
m_Modifications:
131+
- target: {fileID: 2881807433357121327, guid: d9e2b444aec7d514bbee5cf86bcd6848,
132+
type: 3}
133+
propertyPath: buddyDotNoiseGeneration
134+
value: 1
135+
objectReference: {fileID: 0}
131136
- target: {fileID: 3421911329118678122, guid: d9e2b444aec7d514bbee5cf86bcd6848,
132137
type: 3}
133138
propertyPath: m_Name
@@ -136,7 +141,7 @@ PrefabInstance:
136141
- target: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
137142
type: 3}
138143
propertyPath: m_RootOrder
139-
value: 1
144+
value: 0
140145
objectReference: {fileID: 0}
141146
- target: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
142147
type: 3}
@@ -166,12 +171,12 @@ PrefabInstance:
166171
- target: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
167172
type: 3}
168173
propertyPath: m_LocalRotation.y
169-
value: 0
174+
value: -0
170175
objectReference: {fileID: 0}
171176
- target: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
172177
type: 3}
173178
propertyPath: m_LocalRotation.z
174-
value: 0
179+
value: -0
175180
objectReference: {fileID: 0}
176181
- target: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
177182
type: 3}
@@ -190,6 +195,12 @@ PrefabInstance:
190195
objectReference: {fileID: 0}
191196
m_RemovedComponents: []
192197
m_SourcePrefab: {fileID: 100100000, guid: d9e2b444aec7d514bbee5cf86bcd6848, type: 3}
198+
--- !u!4 &1057406319 stripped
199+
Transform:
200+
m_CorrespondingSourceObject: {fileID: 3421911329118678124, guid: d9e2b444aec7d514bbee5cf86bcd6848,
201+
type: 3}
202+
m_PrefabInstance: {fileID: 119745569}
203+
m_PrefabAsset: {fileID: 0}
193204
--- !u!1 &1174472512
194205
GameObject:
195206
m_ObjectHideFlags: 0
@@ -269,7 +280,8 @@ Transform:
269280
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
270281
m_LocalPosition: {x: 0, y: 1, z: -10}
271282
m_LocalScale: {x: 1, y: 1, z: 1}
272-
m_Children: []
283+
m_Children:
284+
- {fileID: 1057406319}
273285
m_Father: {fileID: 0}
274286
m_RootOrder: 0
275287
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

Assets/Scripts/DotStimulus/Dot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class Dot
1414
private readonly float _apertureRadius;
1515
private readonly float _sqrApertureRadius;
1616
private float _elapsedTime;
17-
17+
1818
public Dot(Vector2 velocity, Vector3 startingPosition, StimulusSettings settings)
1919
{
2020
_velocity = velocity;
@@ -34,7 +34,7 @@ public Dot(Vector2 velocity, Vector3 startingPosition, StimulusSettings settings
3434

3535
public void UpdateDot()
3636
{
37-
if (_elapsedTime > _settings.dotLifetime)
37+
if (_elapsedTime > Random.Range(_settings.minDotLifetime, _settings.maxDotLifetime))
3838
{
3939
var randomPosition = Random.insideUnitCircle * _apertureRadius;
4040
_position.x = randomPosition.x;

Assets/Scripts/DotStimulus/DotManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using ScriptableObjects;
1+
using System;
2+
using ScriptableObjects;
23
using UnityEngine;
34
using Random = UnityEngine.Random;
45

@@ -58,8 +59,10 @@ public void InitializeWithSettings(StimulusSettings settings)
5859
var apertureRadius = Mathf.Tan(stimulusSettings.apertureRadiusDegrees * Mathf.PI / 180) *
5960
stimulusSettings.stimDepthMeters;
6061

61-
numDots = Mathf.RoundToInt(Mathf.Pow(stimulusSettings.apertureRadiusDegrees, 2.0f) * Mathf.PI *
62+
var approxMeterPerDegree = Mathf.Tan(1.0f * Mathf.PI / 180.0f) * stimulusSettings.stimDepthMeters;
63+
numDots = Mathf.RoundToInt(Mathf.Pow( apertureRadius / approxMeterPerDegree, 2.0f) * Mathf.PI *
6264
stimulusSettings.density);
65+
6366
if (buddyDotNoiseGeneration && numDots % 2 != 0)
6467
numDots += 1;
6568

Assets/Scripts/Pointer/Pointer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ public void Start()
2323
arrow.SetActive(false);
2424
_pointer = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
2525
_pointer.name = PointerObjectName;
26+
_pointer.transform.SetParent(transform);
2627
_pointer.transform.localScale = new Vector3(thickness, thickness, DefaultDistance);
2728
_pointer.transform.localPosition = new Vector3(0f, 0f, DefaultDistance / 2f);
2829
_pointer.transform.localRotation = Quaternion.Euler(90, 0, 0);
29-
_pointer.transform.SetParent(transform);
30+
3031
_pointer.GetComponent<MeshRenderer>().material = pointerMaterial;
3132
var pointerCollider = _pointer.GetComponent<CapsuleCollider>();
3233
Destroy(pointerCollider);

Assets/Scripts/ScriptableObjects/SessionSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public enum FeedbackType
6868
public bool positionStaircaseEnabled;
6969
public bool directionStaircaseEnabled;
7070
public float fixationErrorTolerance;
71+
public float minDotLifetime;
72+
public float maxDotLifetime;
7173

7274
// IMPORTANT: Any changes made in this function should be cross-checked with both the corresponding JSON
7375
// and the UXF data-points collection
@@ -83,7 +85,8 @@ public void LoadFromUxfJson()
8385
fixationDotRadius = Convert.ToSingle(sessionSettingsDict["FixationDotRadiusDegrees"]);
8486
skyColor = ParseColor((List<object>) sessionSettingsDict["SkyColor"]);
8587
stimulusDensity = Convert.ToSingle(sessionSettingsDict["StimulusDensity"]);
86-
dotLifetime = Convert.ToSingle(sessionSettingsDict["DotLifetimeSeconds"]);
88+
minDotLifetime = Convert.ToSingle(sessionSettingsDict["MinDotLifetimeSeconds"]);
89+
maxDotLifetime = Convert.ToSingle(sessionSettingsDict["MaxDotLifetimeSeconds"]);
8790
dotSize = Convert.ToSingle(sessionSettingsDict["StimulusDotSizeArcMinutes"]);
8891
outerStimulusRadius = Convert.ToSingle(sessionSettingsDict["OuterStimulusRadiusDegrees"]);
8992
outerStimulusNoisePercentage = Convert.ToSingle(sessionSettingsDict["OuterStimulusNoisePercentage"]);

Assets/Scripts/ScriptableObjects/StimulusSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class StimulusSettings : ScriptableObject
2222
public float noiseDotPercentage;
2323
public float dotSizeArcMinutes;
2424
public float speed;
25-
public float dotLifetime;
25+
public float minDotLifetime;
26+
public float maxDotLifetime;
2627
public float stimDepthMeters;
2728
}
2829
}

Assets/Scripts/Settings/DEBUGStimulusSettings.asset

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ MonoBehaviour:
1414
m_EditorClassIdentifier:
1515
correctAngle: 160
1616
coherenceRange: 21
17-
apertureRadiusDegrees: 25
18-
density: 2.5
19-
noiseDotPercentage: 9.6
20-
dotSizeArcMinutes: 12
21-
speed: 21.69
17+
apertureRadiusDegrees: 2
18+
density: 1
19+
noiseDotPercentage: 100
20+
dotSizeArcMinutes: 24
21+
speed: 30
2222
dotLifetime: 200
23-
stimDepthMeters: 1
23+
stimDepthMeters: 6

Assets/Scripts/Settings/InnerStimulusSettings.asset

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ MonoBehaviour:
1212
m_Script: {fileID: 11500000, guid: 1015bda014a000d449230ede5f2f6db5, type: 3}
1313
m_Name: InnerStimulusSettings
1414
m_EditorClassIdentifier:
15-
correctAngle: 225
15+
correctAngle: 270
1616
coherenceRange: 0
1717
apertureRadiusDegrees: 5
18-
density: 1
19-
noiseDotPercentage: 0
20-
dotSizeArcMinutes: 16
18+
density: 2
19+
noiseDotPercentage: 100
20+
dotSizeArcMinutes: 14
2121
speed: 10
22-
dotLifetime: 0.25
23-
stimDepthMeters: 1.99
22+
minDotLifetime: 0.2
23+
maxDotLifetime: 0
24+
stimDepthMeters: 0.569

Assets/Scripts/Settings/OuterStimulusSettings.asset

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ MonoBehaviour:
1515
correctAngle: 0
1616
coherenceRange: 0
1717
apertureRadiusDegrees: 45
18-
density: 1
18+
density: 3.5
1919
noiseDotPercentage: 100
20-
dotSizeArcMinutes: 16
20+
dotSizeArcMinutes: 14
2121
speed: 10
22-
dotLifetime: 0.25
23-
stimDepthMeters: 2
22+
dotLifetime: 0.3
23+
stimDepthMeters: 0.57

0 commit comments

Comments
 (0)