Gaze doesn't always fall exactly upon a character, but may still track its motion. (For example, if you had a bad drift correction, the exact position of your gaze would be off from what you "actually" did, but e.g. the derivative of your gaze vector would track character motion well).
In order to combat this, we could develop a sliding-window correlation of gaze with each character's position:
Get gaze and position data
Define a time window, e.g. 200 ms
Starting at sample 1, look over the next 200ms and correlate gaze with each character's motion
Report the correlation with each character, and also indicate which character has the highest correlation
Move to the next sample
Repeat until... t + 200ms exceeds the video duration?
Gaze doesn't always fall exactly upon a character, but may still track its motion. (For example, if you had a bad drift correction, the exact position of your gaze would be off from what you "actually" did, but e.g. the derivative of your gaze vector would track character motion well). In order to combat this, we could develop a sliding-window correlation of gaze with each character's position: