// api
← Back to homeOllo SDK Docs | 8:45 AM

// API Reference

Ollo reaches your game through its engine plugin: OlloGodotBridge in Godot, UOlloSubsystem in Unreal Engine. For setup and examples, see Ollo for Godot 4 and Ollo for Unreal Engine.


Start and stop

ActionGodotUnreal
Start trackingstart(...)Start(...)
Stop trackingstop()Stop()
Last error codeget_last_error()GetLastErrorCode()
Last error messageget_last_error_string()GetLastErrorString()
SDK versionget_version()GetVersion()

By default, tracking uses camera 0 at 640 x 480 and 30 fps, with the model bundled with the plugin. Starting returns false if tracking can't start, and the error calls say why.


Blink events

Events are the way to read blinks: each one arrives once, in order, on your game's main thread.

EngineHow
GodotCall poll_blink_events() once per frame. It returns the new events as an array of dictionaries, and emits blink_detected or microsleep_detected for each one.
UnrealBind OnBlinkDetected and OnMicrosleep, called On Player Blink and On Player Microsleep in Blueprints.

A microsleep means the eyes stayed shut for over a second. It's reported when they reopen.

Event fields

GodotUnrealMeaning
sequenceSequenceThe event's number, counted from 1 each time tracking starts.
timestampTimestampWhen it was detected, in seconds: since capture began, or on the timestamps you feed.
duration_msDurationMsHow long it lasted, in milliseconds.
qualityQualityThe kind of blink: none, normal, fast, partial or prolonged. In Godot, OlloGodotBridge.QUALITY_NORMAL and so on. In Unreal, EOlloBlinkQuality.
microsleepbMicrosleepTrue for a microsleep.
full_closurebFullClosureFalse for a flutter of the lids, when the eyes never really closed.

Polling

For systems that read Ollo each frame instead of handling events:

ValueGodotUnreal
A blink since the last callis_blink_detected()IsBlinkDetected()
Blinks so farget_blink_count()GetBlinkCount()
Time of the last blinkget_last_blink_time()GetLastBlinkTime()
Eyes closed right nowis_eye_closed()IsEyeClosed()
All of the above, and moreget_state()GetState()

Reading is_blink_detected() clears it, so call it from one place, once a frame. Blinks between two calls count as one; the blink count still counts them all.

State fields

GodotUnrealMeaning
tracking_validbTrackingValidA face is being tracked.
pose_stablebPoseStableThe head is steady enough to track blinks.
baseline_validbBaselineValidOllo has learned the player's open eyes, and can detect blinks.
blink_countBlinkCountBlinks since tracking started.
last_blink_timeLastBlinkTimeThe time of the last blink, in seconds.
eye_closedbEyeClosedThe eyes are closed right now.

Gaze

Gaze is off until you ask for it, and it needs calibrating. Start with enable_gaze in Godot or bEnableGaze in Unreal, then:

  1. Show the player a target. While they look at it, call add_gaze_calibration_point(x, y) or AddGazeCalibrationPoint(X, Y) with its position, in any coordinates you like, such as screen pixels.

  2. If the call returns false, keep the target up and call again on the next frame.

  3. Repeat across the screen. The more of it your targets cover, the better the estimate.

  4. Read get_gaze() or GetGaze(). When it's valid, it says where the player is looking, in your coordinates.

To start again, call clear_gaze_calibration() or ClearGazeCalibration(). Passing false as a calibration call's last argument makes a weak hint that fades within a second, instead of a lasting point.

Gaze fields

GodotUnrealMeaning
validbValidThere is an estimate. False while uncalibrated, or while the eyes are lost.
x_smooth, y_smoothXSmooth, YSmoothWhere the player is looking, in your coordinates.
calibration_pointsCalibrationPointsCalibration points held.
timestampTimestampThe time of the frame the estimate came from, in seconds.

Performance

get_performance() in Godot and GetPerformance() in Unreal report how tracking is running:

GodotUnrealMeaning
avg_fpsAvgFPSFrames tracked per second.
avg_processing_msAvgProcessingMsTime to process a frame, in milliseconds.
avg_latency_msAvgLatencyMsTime from capture to result, in milliseconds.
frame_queue_sizeFrameQueueSizeFrames waiting to be processed.
frames_droppedFramesDroppedFrames skipped.
frames_processedFramesProcessedFrames tracked.
uptime_secUptimeSecSeconds since tracking started.

Feeding your own frames

Start with camera index -1, then hand Ollo each frame:

EngineCall
Godotfeed_image(img), or feed_image_timestamped(img, timestamp_sec) to set the time yourself.
UnrealFeedFrameRGBA(Pixels, Width, Height, TimestampSec), with at least Width * Height * 4 bytes of RGBA pixels.

Timestamps can't go backwards: a frame earlier than the last one is refused.


Error codes

CodeMessageWhat to do
0OKNothing.
1Already runningStop tracking before starting it again.
2Model not foundCheck the model path. With no path set, check that the plugin's bin folder holds every file from the zip.
3Failed to load modelThe model file is damaged, or isn't one Ollo can read. Restore it from the zip.
4Failed to open cameraCheck the camera index, and that no other app is using the camera.
5Camera permission deniedAllow camera access in Windows' privacy settings.
6Internal exceptionRare. Please report it.
7Unknown errorRare. Please report it.
8Tracking stoppedThe evaluation ended: sign the machine in, or ship a stamped build. See SDK Activation.
9Worker startup timed outThe camera or the model took too long to start. Try again, and check the camera.
10Failed to load the vision moduleCheck that the plugin's bin folder holds every file from the zip, unchanged.