Home Forums Legacy SDKs Cursor follow the gaze point constantly? Reply To: Cursor follow the gaze point constantly?

#5218
Alex [Tobii]
Participant

if starting:
  k = 0.1
  currentX = 0
  currentY = 0

x = tobiiEyeX.gazePointInPixelsX
y = tobiiEyeX.gazePointInPixelsY

currentX = currentX + (x-currentX)*k
currentY = currentY + (y-currentY)*k

mouse.setCursorPosition(currentX, currentY)

you will also need to add a new method to freepie mouse plugin:


public class MousePlugin : Plugin
...
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetCursorPos(int X, int Y);

public void SetCursorPosition(int x, int y)
{
  SetCursorPos(x, y);
}
...
public class MouseGlobal
...
public void setCursorPosition(int x, int y)
{
  plugin.SetCursorPosition(x, y);
}