Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
42ffa4d
Start on a parent class
thompson318 Jan 27, 2026
2f0c629
Progressing on new fixed buffer
thompson318 Jan 27, 2026
840d5cf
Implementation for gaze - tested but not working yet.
thompson318 Jan 27, 2026
26bb53d
Uses tobiibuffer for gaze and pose buffers and removes RingBuffer.cs
thompson318 Feb 2, 2026
9f85c9b
Return to MIT license.
thompson318 Feb 2, 2026
e3486f6
Merge branch 'main' into st/newbuffer
thompson318 Feb 2, 2026
ca1b8d7
Style fix
thompson318 Feb 2, 2026
c0f5869
Adding some documentation
thompson318 Feb 2, 2026
c1d2bb1
Rearranged classes so that all logic is contained in base class with …
thompson318 Feb 3, 2026
e0b20ff
Apply suggestion from @thompson318
thompson318 Feb 3, 2026
4a1a9fa
We can mark tobiibuffer as internal to make it clearer which classes …
thompson318 Feb 3, 2026
cbd8e4e
very rough restructure
K-Meech Feb 4, 2026
9454959
Merge branch 'km/buffer-expts' into st/newbuffer
thompson318 Feb 10, 2026
dbc82bc
Get running again after new buffer implementation.
thompson318 Feb 10, 2026
edc56e1
Updated doc strings
thompson318 Feb 10, 2026
2f89f1c
Fix data check and add error message if bad values added for capacity…
thompson318 Feb 10, 2026
deb7bec
Tidied up documentation after new implementation.
thompson318 Feb 10, 2026
4de5c60
Update projects/AstroBalance/Assets/Scripts/TrackerBuffers.cs
thompson318 Feb 11, 2026
41ff0d5
Update projects/AstroBalance/Assets/Scripts/TrackerBuffers.cs
thompson318 Feb 11, 2026
4250b5a
Update projects/AstroBalance/Assets/Scripts/TrackerBuffers.cs
thompson318 Feb 11, 2026
e3fcb4f
Update variable names
thompson318 Feb 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
695 changes: 21 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

304 changes: 0 additions & 304 deletions projects/AstroBalance/Assets/Scripts/RingBuffer.cs

This file was deleted.

2 changes: 0 additions & 2 deletions projects/AstroBalance/Assets/Scripts/RingBuffer.cs.meta

This file was deleted.

39 changes: 20 additions & 19 deletions projects/AstroBalance/Assets/Scripts/RocketLaunch/LaunchCode.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using TMPro;
using Tobii.GameIntegration.Net;
using TrackerBuffers;
using UnityEngine;

/// <summary>
Expand Down Expand Up @@ -41,6 +40,7 @@ public class LaunchCode : MonoBehaviour
private float timeToSpriteChange;
private Sprite countDownSprite;
private GazeBuffer gazeBuffer;
private int minDataRequired = 2; // we need at least 2 data points to calculate steadiness.

void Start()
{
Expand All @@ -50,36 +50,37 @@ void Start()
countDownSprites.Remove(countDownSprite);
gameObject.GetComponent<SpriteRenderer>().sprite = countDownSprite;
timeToSpriteChange = timerDuration;
gazeBuffer = new GazeBuffer(gazeBufferCapacity);
gazeBuffer = new GazeBuffer(gazeBufferCapacity, minDataRequired);
}

void Update()
{
GazePoint gazePoint = new GazePoint();
GazeItem gazeItem = new GazeItem();
if (useMouseForTracker)
{
var mousePos = Input.mousePosition;
gazePoint.X = mousePos.x;
gazePoint.Y = mousePos.y;
gazePoint.TimeStampMicroSeconds = (long)(Time.timeSinceLevelLoad * 1000000);
gazeItem.gazePoint.X = mousePos.x;
gazeItem.gazePoint.Y = mousePos.y;
gazeItem.gazePoint.TimeStampMicroSeconds = (long)(Time.timeSinceLevelLoad * 1000000);
}
else
{
gazePoint = tracker.getGazePoint();
Vector2 worldGaze = tracker.ConvertGazePointToWorldCoordinates(gazePoint);
gazePoint.X = worldGaze.x;
gazePoint.Y = worldGaze.y;
gazeItem.gazePoint = tracker.getGazePoint();
Vector2 worldGaze = tracker.ConvertGazePointToWorldCoordinates(gazeItem.gazePoint);
gazeItem.gazePoint.X = worldGaze.x;
gazeItem.gazePoint.Y = worldGaze.y;
}

gazeBuffer.addIfNew(gazePoint);
gazeBuffer.addIfNew(gazeItem);

bool gazeIsSteady = false;
GazePoint targetPoint = new GazePoint();
float targetX = 0f;
float targetY = 0f;
if (targetObject != null)
{
targetPoint.X = targetObject.transform.position.x;
targetPoint.Y = targetObject.transform.position.y;
gazeIsSteady = gazeBuffer.gazeSteady(gazeTime, gazeTolerance, targetPoint);
targetX = targetObject.transform.position.x;
targetY = targetObject.transform.position.y;
gazeIsSteady = gazeBuffer.gazeSteady(gazeTime, gazeTolerance, targetX, targetY);
}
else
{
Expand All @@ -91,14 +92,14 @@ void Update()
string steadyText = gazeIsSteady ? "Gaze is steady" : "Gaze is not steady";
statusText.text =
"Look here -> "
+ targetPoint.X
+ targetX
+ ", "
+ targetPoint.Y
+ targetY
+ "\n"
+ "Looking here -> "
+ gazePoint.X
+ gazeItem.gazePoint.X
+ ", "
+ gazePoint.Y
+ gazeItem.gazePoint.Y
+ "\n"
+ steadyText;
}
Expand Down
Loading