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.
| Action | Godot | Unreal |
|---|---|---|
| Start tracking | start(...) | Start(...) |
| Stop tracking | stop() | Stop() |
| Last error code | get_last_error() | GetLastErrorCode() |
| Last error message | get_last_error_string() | GetLastErrorString() |
| SDK version | get_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.
Events are the way to read blinks: each one arrives once, in order, on your game's main thread.
| Engine | How |
|---|---|
| Godot | Call 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. |
| Unreal | Bind 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.
| Godot | Unreal | Meaning |
|---|---|---|
sequence | Sequence | The event's number, counted from 1 each time tracking starts. |
timestamp | Timestamp | When it was detected, in seconds: since capture began, or on the timestamps you feed. |
duration_ms | DurationMs | How long it lasted, in milliseconds. |
quality | Quality | The kind of blink: none, normal, fast, partial or prolonged. In Godot, OlloGodotBridge.QUALITY_NORMAL and so on. In Unreal, EOlloBlinkQuality. |
microsleep | bMicrosleep | True for a microsleep. |
full_closure | bFullClosure | False for a flutter of the lids, when the eyes never really closed. |
For systems that read Ollo each frame instead of handling events:
| Value | Godot | Unreal |
|---|---|---|
| A blink since the last call | is_blink_detected() | IsBlinkDetected() |
| Blinks so far | get_blink_count() | GetBlinkCount() |
| Time of the last blink | get_last_blink_time() | GetLastBlinkTime() |
| Eyes closed right now | is_eye_closed() | IsEyeClosed() |
| All of the above, and more | get_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.
| Godot | Unreal | Meaning |
|---|---|---|
tracking_valid | bTrackingValid | A face is being tracked. |
pose_stable | bPoseStable | The head is steady enough to track blinks. |
baseline_valid | bBaselineValid | Ollo has learned the player's open eyes, and can detect blinks. |
blink_count | BlinkCount | Blinks since tracking started. |
last_blink_time | LastBlinkTime | The time of the last blink, in seconds. |
eye_closed | bEyeClosed | The eyes are closed right now. |
Gaze is off until you ask for it, and it needs calibrating. Start with enable_gaze in Godot or bEnableGaze in Unreal, then:
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.
If the call returns false, keep the target up and call again on the next frame.
Repeat across the screen. The more of it your targets cover, the better the estimate.
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.
| Godot | Unreal | Meaning |
|---|---|---|
valid | bValid | There is an estimate. False while uncalibrated, or while the eyes are lost. |
x_smooth, y_smooth | XSmooth, YSmooth | Where the player is looking, in your coordinates. |
calibration_points | CalibrationPoints | Calibration points held. |
timestamp | Timestamp | The time of the frame the estimate came from, in seconds. |
get_performance() in Godot and GetPerformance() in Unreal report how tracking is running:
| Godot | Unreal | Meaning |
|---|---|---|
avg_fps | AvgFPS | Frames tracked per second. |
avg_processing_ms | AvgProcessingMs | Time to process a frame, in milliseconds. |
avg_latency_ms | AvgLatencyMs | Time from capture to result, in milliseconds. |
frame_queue_size | FrameQueueSize | Frames waiting to be processed. |
frames_dropped | FramesDropped | Frames skipped. |
frames_processed | FramesProcessed | Frames tracked. |
uptime_sec | UptimeSec | Seconds since tracking started. |
Start with camera index -1, then hand Ollo each frame:
| Engine | Call |
|---|---|
| Godot | feed_image(img), or feed_image_timestamped(img, timestamp_sec) to set the time yourself. |
| Unreal | FeedFrameRGBA(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.
| Code | Message | What to do |
|---|---|---|
| 0 | OK | Nothing. |
| 1 | Already running | Stop tracking before starting it again. |
| 2 | Model not found | Check the model path. With no path set, check that the plugin's bin folder holds every file from the zip. |
| 3 | Failed to load model | The model file is damaged, or isn't one Ollo can read. Restore it from the zip. |
| 4 | Failed to open camera | Check the camera index, and that no other app is using the camera. |
| 5 | Camera permission denied | Allow camera access in Windows' privacy settings. |
| 6 | Internal exception | Rare. Please report it. |
| 7 | Unknown error | Rare. Please report it. |
| 8 | Tracking stopped | The evaluation ended: sign the machine in, or ship a stamped build. See SDK Activation. |
| 9 | Worker startup timed out | The camera or the model took too long to start. Try again, and check the camera. |
| 10 | Failed to load the vision module | Check that the plugin's bin folder holds every file from the zip, unchanged. |