tracky-mouse
tracky-mouse copied to clipboard
Head tracking circularity: balance diagonal movement with horizontal/vertical movement
I've found that moving diagonally requires too much head movement compared to horizontal/vertical movement.
- Moving to the corners of the screen is uncomfortable, and tends to require some leaning in addition to tilting, when I have it otherwise configured to comfortably move to the left/right and top/bottom of the screen.
- Trying to draw a circle in JS Paint, I get something squarish.
Acceleration curves may be playing a role in this. Currently the acceleration curve is applied to deltaX and deltaY independently, with the distance parameter being ignored here:
// Acceleration curves add a lot of stability,
// letting you focus on a specific point without jitter, but still move quickly.
// var accelerate = (delta, distance) => (delta / 10) * (distance ** 0.8);
// var accelerate = (delta, distance) => (delta / 1) * (Math.abs(delta) ** 0.8);
var accelerate = (delta, distance) => (delta / 1) * (Math.abs(delta * 5) ** acceleration);
var distance = Math.hypot(movementX, movementY);
var deltaX = accelerate(movementX * sensitivityX, distance);
var deltaY = accelerate(movementY * sensitivityY, distance);
If you picture the head as a sphere, it makes sense that diagonal movements are weakened, due to the projection, in combination with the acceleration curves.
Tilting up, down, left, or right, the projected point is moved in a single axis, whereas tilting diagonally moves sqrt(2)/2 in each axis.
When spread across two axes, with the acceleration curves applying separately, the exponentiation isn't as high.
That said, there may be a reason why I didn't use the distance parameter here; maybe it even makes it worse somehow.
I might need a separate sort of filter to compensate for diagonal movement feeling subdued, reminiscent of the pin-cushion adjustment on old CRT monitors.
Related:
- https://github.com/1j01/tracky-mouse/issues/28
- https://github.com/1j01/tracky-mouse/issues/32
- https://github.com/1j01/tracky-mouse/issues/45