Home Forums Software Development Get Eye-screen-coordinates and match it with a Unity game object

Tagged: 

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #12222
    pepito
    Participant

    Hi, I need urgently a code to MOVE my object with my gaze point. On my game I move the object in the same position as the mouse is moving. The object it’s limitated on the space (I don’t know if this is relevant):
    public Rect movementLimits = new Rect(-7, 0, 14, 10);
    But I don’t know how to actually move the object with the eye tracker, I don’t know if I have to transform the coordinates or if I have to use a command on the player behaviour scrpit. Because when I use the eye tracker normally, without unity, transforms into the cursor automatically. But when I start the game, it dissapear.
    Please I need someone to help me urgently.

    #12228
    Grant [Tobii]
    Keymaster

    Hi @stefy001, you can try assigning the object position to TobiiAPI.GetGazePoint().Screen

    But please bear in mind that the gaze point is not highly accurate and has inherent jitters due to the biological nature of human eye movement so it should not be used as direct mouse replacement.. you would need to introduce some kind of fixation filter or movement buffer to make the action smooth.

    But please do try it out and let us know how you get on.

    #12258
    pepito
    Participant

    Okey I will try (I think I already tried it) but I don’t know WHERE I have to put that command, and you mean that I have to put the mouse posittion command UNDER that line?

    #12262
    Grant [Tobii]
    Keymaster

    Hi@ stefy001. I am afraid Without knowing your scene setup, it is difficult to give you an exact syntax, but perhaps this snippet can be useful for you.

    void Update()
    { 
      var gaze = TobiiAPI.GetGazePoint().Screen; 
      transform.position = Camera.main.ScreenToWorldPoint(new Vector3(gaze.x, gaze.y, 10)); 
    }

    Let us know how that helps.

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.