Home › Forums › Software Development › Move only on the X axe › Reply To: Move only on the X axe
If you only want to change the X value, then only change the X value in your code.
Hard-code the Y value to the Y position you want your paddle to slide along, and update the X value according to the Gaze Point’s X value.
You should probably also do some filtering of the Gaze Point’s X value so that the paddle does not jiggle or jump back and forth.
You can filter the eye-gaze data by calculating a moving average using the last 10 Gaze Points. Here is a simple description of how to calculate a moving average:
This will make all paddle movements overall slower and smoother.
A more advanced filtering would be to use an exponentially decaying filter as explained here:
This would make the paddle steady when the eye-gaze is focused on specific point, but fast when moving the eye-gaze to another part of the screen.