Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Mouse scroll wheel input not consistent

Discussion in 'WebGL' started by acr1378, Dec 13, 2019.

  1. acr1378

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    76
    I'm having problems with the mouse scroll wheel input in WebGL. I have a zoom method that uses the Input.mouseScrollDelta.y. It works perfectly, all the time, in all browsers when scrolling with two finger swipe gestures on a trackpad. This has been tested on macs and windows devices. However, with a USB mouse, the scroll is initially way too slow. I've debugged it and the actual input from mouseScrollDelta is much smaller than from the trackpad.

    Now, if I have both a USB mouse and a trackpad, I can...
    1) test with the mouse first: same slow behaviour
    2) switch back to the trackpad: works great
    3) switch back to mouse: now the scroll speed is normal or too fast
    4) keep switching back and forth: mouse scroll speed becomes way too fast

    Again, all this is reflected in the input.mouseScrollDelta variable, so I know it's not something stupid in my code. Any ideas why this is happening?
     
    Aoedipus likes this.
  2. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    @acr1378 have you found a solution to this? I have the same problem, the delta value is not agnostic so for touchpads it seems to be a measure of pixels travelled ot something like that, you end up with hundreds per input event (frame most of the times) and with the mouse scroll wheel delta seems to be +-6 for each scrollwheel step (most scroll wheels have a stepped rotation). so either you make the sensibility too fast for touchpad or too slow for mouse wheel, there is no api to tell you which input hardware is being used... even with the new input system
     
  3. acr1378

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    76
    @Cleverlie Thanks for the info. I put this aside for awhile, but I haven't found a solution to it yet. Let me know if you come up with anything and I'll do the same. Might be worth submitting a bug report...