Home › Forums › Game Integration › Drawing game with Tobii eye tracker 5
Tagged: game design
- This topic has 1 reply, 2 voices, and was last updated 1 year ago by Grant [Tobii].
- 28/04/2022 at 20:51 #21837Zachary GrayParticipant
Hello all, I am new to Unity and using C#. I have made a drawing game where you can draw a line by pressing down the mouse button but I intend this to be created with the eye; where the eye tracker will see where I am looking and it will generate the line on the screen instead of using the mouse. I am aware that the line might be jittery and inaccurate, but that doesn’t matter!
There is a game object within my scene with a script (called LineGenerator) attached as a component, here is the piece of code that is attached:
public class LineGenerator : MonoBehaviour
public GameObject linePrefab;
// Update is called once per frame
GameObject newLine = Instantiate(linePrefab);
activeLine = newLine.GetComponent<Line>();
activeLine = null;
if (activeLine != null)
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
The “linePrefab” stored in the public variable “GameObject” is a game object (stored in my prefab folder) with a line renderer attached.
I have the Unity SDK downloaded and this might have the capability to do what I’d like it to, but I am fairly unfamiliar with that as well. Help would be tremendously appreciated!04/05/2022 at 12:59 #21847Grant [Tobii]Keymaster
Hi @zakg, the Tobii XR SDK comes with several sample scenes that should demonstrate clearly how to access the gaze streams .. please check them out and let us know how you get on. Best Wishes.
- You must be logged in to reply to this topic.