Tobii Pro SDK Unity API
IEyeTracker_GetAndSetDisplayArea.cs
using System.Collections;
using UnityEngine;
namespace Tobii.Research.CodeExamples
{
using System;
class IEyeTracker_GetAndSetDisplayArea
{
public static IEnumerator Execute(IEyeTracker eyeTracker)
{
if (eyeTracker != null)
{
PrintDisplayArea(eyeTracker);
yield break;
}
}
// <BeginExample>
private static void PrintDisplayArea(IEyeTracker eyeTracker)
{
// Get the display area.
DisplayArea displayArea = eyeTracker.GetDisplayArea();
Debug.Log(string.Format(
"Got display area from tracker with serial number {0} with height {1}, width {2} and coordinates:",
eyeTracker.SerialNumber,
displayArea.Height,
displayArea.Width));
Debug.Log(string.Format("Bottom Left: ({0}, {1}, {2})",
displayArea.BottomLeft.X, displayArea.BottomLeft.Y, displayArea.BottomLeft.Z));
Debug.Log(string.Format("Bottom Right: ({0}, {1}, {2})",
displayArea.BottomRight.X, displayArea.BottomRight.Y, displayArea.BottomRight.Z));
Debug.Log(string.Format("Top Left: ({0}, {1}, {2})",
displayArea.TopLeft.X, displayArea.TopLeft.Y, displayArea.TopLeft.Z));
Debug.Log(string.Format("Top Right: ({0}, {1}, {2})",
displayArea.TopRight.X, displayArea.TopRight.Y, displayArea.TopRight.Z));
// Set the display area. A new object is used to show usage.
DisplayArea displayAreaToSet = new DisplayArea(displayArea.TopLeft, displayArea.BottomLeft, displayArea.TopRight);
eyeTracker.SetDisplayArea(displayAreaToSet);
}
// <EndExample>
}
}