The core module is the minimal set you need to use eyetracking in UE4. It provides you with all of the low level data that we provide from our eyetrackers. The module is also eyetracker agnostic, so you don’t have to care what model or type of Tobii eyetracker you have, be it a desktop or XR tracker. If you have both a desktop and XR tracker connected, it will pick whichever eyetracker type best matches your main player controller. You can override this behavior by using the SetEyeTrackedPlayer function in the C++ API.

    virtual void SetEyeTrackedPlayer(APlayerController* PlayerController) = 0;

 

The core module is primarily a C++ API, but it does have a blueprint interface as well, containing a subset of the functions found in C++. The API also implements the generic eyetracking interface added in UE4.20, but be very careful as the generic functions have very similar names to our API for obvious reasons, but provides a lot less data.

When working with blueprints, be mindful when accessing low level data, pay attention to the category the function you are trying to use to grab the correct one:

  1. The generic functions. These are intended to work with any eyetracker that implements the engine’s interface but supplies limited data.
  2. Tobii functions that provide you with the full feature set.

That being said, we strongly discourage the use of raw eyetracking signals. Almost any interaction you might want to design will most likely benefit from using GTOM in some way instead of the raw gaze signal. If your particular application for whatever reason cannot use GTOM, you can query gaze data using these functions:

//C++ API:

    virtual const FTobiiGazeData& GetCombinedGazeData() const = 0;
    virtual const FTobiiGazeData& GetLeftGazeData() const = 0;
    virtual const FTobiiGazeData& GetRightGazeData() const = 0;

    virtual const FHitResult& GetCombinedWorldGazeHitData() const = 0;
    virtual const FHitResult& GetLeftWorldGazeHitData() const = 0;
    virtual const FHitResult& GetRightWorldGazeHitData() const = 0;

//Blueprint API:

    UFUNCTION(BlueprintPure, Category = "Tobii Eyetracking")
    static FTobiiGazeData GetCombinedGazeData();
    UFUNCTION(BlueprintPure, Category = "Tobii Eyetracking")
    static FTobiiGazeData GetLeftGazeData();
    UFUNCTION(BlueprintPure, Category = "Tobii Eyetracking")
    static FTobiiGazeData GetRightGazeData();
    UFUNCTION(BlueprintPure, Category = "Tobii Eyetracking")
    static FHitResult GetCombinedWorldGazeHitData();

The world gaze hit data family of functions will, as the name suggests, provide you with information where the gaze point intersects the world.

Some functions that are useful from the core module no matter if you are using GTOM or not however, are the status reporting functions:

//C++ API:

    virtual ETobiiGazeTrackerStatus GetGazeTrackerStatus() const = 0;

//Blueprint API:

    UFUNCTION(BlueprintPure, Category = "Tobii Eyetracking")
    static ETobiiGazeTrackerStatus GetGazeTrackerStatus();
    

This will indicate the readiness of the gaze tracking subsystem, which is very useful when trying to determine if gaze features should be active, and how features that support both eyetracking and other interaction should behave. Please note that the “UserNotPresent” in the ETobiiGazeTrackerStatus enumeration is not relevant in XR, so just ignore it if you are not on desktop.

UENUM(BlueprintType)
enum class ETobiiGazeTrackerStatus : uint8
{
    NotConnected                    UMETA(DisplayName = "Not Connected")                        /** The gaze tracker is not connected to UE4 for some reason. The tracker might not be plugged in, the game window is currently running on a screen without a gaze tracker or is otherwise not available. */
    , NotConfigured                 UMETA(DisplayName = "Not Configured")                       /** The gaze tracker is connected, but cannot track as it is missing some important configuration step. */
    , Disabled                      UMETA(DisplayName = "Disabled")                             /** Gaze Tracking has been disabled by the user or developer or some other eventuality, like for example the game being minimized which might suspend the tracking. */
    , UserNotPresent                UMETA(DisplayName = "User Not Present")                     /** The gaze tracker is running but has not yet detected a user. Not relevant in XR. */
    , UserPresent                   UMETA(DisplayName = "User Present")                         /** The gaze tracker has detected a user and is actively tracking them. They appear not to be focusing on the game window at the moment however, so be careful about how you are using the data. */
};