[Solved] Unity 5 DisplaySize and ScreenBounds are invalid

Home Forums Game Integration [Solved] Unity 5 DisplaySize and ScreenBounds are invalid

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5843
    Yann MORERE
    Participant

    ]Hi,

    I’m using a tobbii eyex with Unity5 and the Tobbi SDK.
    I’m trying to display each eye positions using GetEyePositionDataProvider();

    the methods returns the position in milimeters, but I want the real position of the screen. I’m trying to use DisplaySize and ScreenBounds to compute the position on the screen but the returned values are zeros, because thay are invalid. Here is my code :

    
        public GameObject leftEye, rightEye;
        private EyeXHost _eyeXHost;
        private IEyeXDataProvider<EyeXEyePosition> _eyePointProvider;
        private EyeXEngineStateValue<Size2> displaySize;
        private EyeXEngineStateValue<Tobii.EyeX.Client.Rect> screenBounds;
        
    
        public void Awake()
        {
            _eyeXHost = EyeXHost.GetInstance();
            _eyePointProvider = _eyeXHost.GetEyePositionDataProvider();
            displaySize = _eyeXHost.DisplaySize;
            screenBounds = _eyeXHost.ScreenBounds;
    
            if (displaySize.IsValid)
                Debug.Log(displaySize.Value.Width + " " + displaySize.Value.Height);
            else
                Debug.Log("displaySize invalid");
            if (screenBounds.IsValid)
                Debug.Log(screenBounds.Value.Width + " " + screenBounds.Value.Height);
            else
                Debug.Log("displayBoundsSize invalid");
        }
    
    #5847
    Jenny [Tobii]
    Participant

    Hi @yann-morere,

    When you say that you are trying to “compute the position on the screen” I suspect that the data you really want is Gaze Point data. A GazePoint is the point on the screen where the user is looking, and is a point position aggregated of gaze data from both eyes. The GazePoint class has properties for getting the point in Screen, Viewport and GUI coordinates.

    The Eye Positions are the positions of the eye balls in 3D space, the positions are relative to the screen center but it does not say anything of where on the screen the user is looking. This data is also quite hard to make use of since it does not provide a stable signal. We currently consider it as an experimental data stream that should be used with caution.

    Now, for the ScreenBounds and DisplaySize state values returning invalid values – this is actually expected behavior the first time the values are asked for. The call to the underlying API is asynchronous, and we have to wait for a callback before the values can be updated correctly. In your code snippet above, you only make one call and in the Awake method, where the eye tracking host has just barely been initialized. Code that depend on the values of these states need to be placed in the Update loop or some other method that is called repeatedly, and have a check for the values being valid before they are used.

    I notice you are using the 1.7 Unity SDK. I would like to encourage you to move to the recently released Tobii EyeTracking SDK for Unity – v2.0. It has a lot of improvements and also comes with online Manual and Scripting Reference documentation. It is available on the Downloads page.

    I hope this gets you going with your project, and I look forward to seeing what cool stuff you build with the SDK!

    #5848
    Yann MORERE
    Participant

    Thanks for these informations. I figured out by reading deeply the documentation. But your reply is very interesting and validate what i did yesterday. I Will upgraded to the 2.0 release.
    Is it possible to get each eye position from the gaze point?

    #5849
    Yann MORERE
    Participant

    Actually I integrating the tobii EyeX eyetracker in my Wheelchair simulator to analyse the gase during the driving. Unity is a great tool to do that. And the EyeX device is working great once it is correctly installed ! 😉

    This afternoon, I switched to the Unity SDK 2. Yes it is simpler :). Thanks for the advice? Now the Dataproviders do not need to be attach the gameObject. Only the script which collect the data from the eyetracker.

    #5851
    Jenny [Tobii]
    Participant

    I’m glad to hear it worked out and that you can advantage of the simplified API of the 2.0 SDK! It seems like a very cool application of the Tobii EyeX Controller to use it for a Wheelchair simulator 🙂

    For your question: “Is it possible to get each eye position from the gaze point?”, the answer is no, we do not provide the gaze point on the screen of the individual eyes. Our consumer licensed API’s do not provide detailed information from the eye trackers, for that a Tobii Pro product and license is needed.

    #6427
    Yann MORERE
    Participant

    thanks for this reply.

    yann

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.