sotrh/learn-wgpu

MouseMotion delta is not precise

infality opened this issue · 3 comments

When moving the mouse slightly I can see that the camera is moving along a grid horizontally and vertically and it does not feel smooth. I guess the reason for this is DeviceEvent::MouseMotion.delta returning only whole numbers. As long as I don't move the mouse very quickly the delta values are always either 0 or +/- 1, I never see any values with decimal digits. This results in any slow mouse movement to move at the same speed.

Is this only happening for me? I could not find anything about this online.
I'm on Linux with X11 and tested this on the tutorial12-camera project.
It also behaves like this in the browser on the tutorial page, but it's only noticeable when resized to the full screen.

Having the same issue on Windows 10. rust-windowing/winit#1418 seems to have some discussion on similar problems, but I am not familiar enough with these crates to find a reasonable workaround.

Actually, this may be a duplicate of #294.

I saw these two issues as well. The first one looked more like a timing issue/lag, with events missing for several milliseconds.
The second might be the same as my problem, I did not really look into it since the camera does behave like this regardless if I move or not. Seems like input needs to be polled more often because the camera is smooth with unlimited fps (no vsync), but I'm also new to this and don't know what needs to be done to receive more DeviceEvent::MouseMotion events per second while keeping the same frame rate.