Beispiel #1
0
 Vector2 GazeToGameWindow(GazeIO.Sample aSample)
 {
     return(new Vector2(
                aSample.x - Screen.width / 2 - _offset.x,
                Screen.height / 2 - (aSample.y - _offset.y)
                ));
 }
Beispiel #2
0
    // internal methods

    void ParseMessage(string aMessage)
    {
        GazeIO.Sample sample = JsonUtility.FromJson <GazeIO.Sample>(aMessage);
        if (sample.isValid)
        {
            //print($"WS:> sample = {sample.x}, {sample.y}");
            UpdateCursorLocation(sample);
            return;
        }

        GazeIO.State state = JsonUtility.FromJson <GazeIO.State>(aMessage);
        if (state.isValid)
        {
            //print($"WS:> status = {state.value}");
            UpdateState(state);
            return;
        }

        GazeIO.Device device = JsonUtility.FromJson <GazeIO.Device>(aMessage);
        if (device.isValid)
        {
            //print($"WS:> device name = {device.name}");
            UpdateDeviceInfo(device);
            return;
        }
    }
Beispiel #3
0
 public void MoveTo(GazeIO.Sample aGazePoint)
 {
     if (_enabled)
     {
         _image.transform.localPosition = new Vector3(aGazePoint.x - Screen.width / 2, Screen.height / 2 - aGazePoint.y + _correctionY, 0);
     }
 }
Beispiel #4
0
 public SampleArgs(ulong aTimestamp, float aX, float aY, float aPupil)
 {
     sample      = new GazeIO.Sample();
     sample.type = GazeIO.MessageType.sample;
     sample.ts   = aTimestamp;
     sample.x    = aX;
     sample.y    = aY;
     sample.p    = aPupil;
 }
Beispiel #5
0
    void UpdateCursorLocation(GazeIO.Sample aSample)
    {
        Vector2 location = GazeToGameWindow(aSample);

        this.location = _smoother.Feed(new RawPoint(aSample.ts, location.x, location.y));
        // debug.text = $"S = {aSample.x:N0} {aSample.y:N0}; F = {this.location.x:N0} {this.location.y:N0}";

        Sample(this, new EventArgs());
    }
Beispiel #6
0
    void UpdateCursorLocation(GazeIO.Sample aSample)
    {
        Vector2 location = GazeToGameWindow(aSample);

        pointer.anchoredPosition = location;

        _location = _smoother.Feed(new RawPoint(aSample.ts, location.x, location.y));

        Sample(this, new EventArgs());
    }
Beispiel #7
0
 private void onTobiiData(object sender, GazeIO.Sample sample)
 {
     lastSample = sample;
     UpdateCursorLocation(sample);
 }