Feature request: vector mouse movement

Please implement mouse movement via a vector for the UHK. Currently, pressing the up and left mouse keys simultaneously on the keyboard moves the mouse faster across the screen than pressing just one of the buttons. Having the mouse speed be inconsistent depending on whether or not you are moving the pointer diagonally is bad UX. This is basic functionality for a WASD-style input in any video game.

I believe the current implementation looks like this:

perFrameFunction(){
  pointerPos = {x, y}
  pointerSpeed = // Some acceleration math
  if (mouseKeyUpPressed) {
    pointerPos.x += pointerSpeed
  }
  if (mouseKeyRightPressed) {
    pointerPos.y += pointerSpeed
  }
  // Similar code for down and left
}

It should look like this:

perFrameFunction(){
  pointerPos = {x, y}
  pointerVector = {x, y} // Normalized value - vector length is 1
  pointerSpeed = // Some acceleration math
  if (mouseKeyUpPressed) {
     pointerVector.x += pointerTurnRate
  }
  if (mouseKeyRightPressed) {
    pointerVector.y += pointerTurnRate
  }
  // Similar code for down and left
  pointerPos += normalize(pointerVector) * pointerSpeed
}

Actually this is on purpose - Laszlo prefers it this way, as he is used to that from old computer games :-).

Anyways, this has been raised before, and these days there is a “Compensate diagonal speed” checkbox in Agent’s “Mouse key speed” page.

1 Like

Got it - I had an older version of UHK Agent without this checkbox. Thank you!

If the community prefers, we can default to “Compensate diagonal speed” enabled. I’m not against it; I just haven’t thought about it.

1 Like