Reported mouse movement is massively slower on Wasm than on native when cursor is locked #18855
Labels
A-Input
Player input via keyboard, mouse, gamepad, and more
A-Windowing
Platform-agnostic interface layer to run your app in
C-Bug
An unexpected or incorrect behavior
O-Web
Specific to web (WASM) builds
S-Blocked
This cannot move forward until something else changes
Bevy version
0.15.3 and 0.16.0-rc.5
Relevant system information
native:
firefox:
chromium:
Firefox:
137.0 (64-bit)
Chromium:
Version 135.0.7049.84 (Official Build) (64-bit)
What you did
Either execute this Bevy playground snippet directly or write this code:
main.rs
Now run it once using
bevy run
and once usingbevy run web
. On web, open the console to see the output.What went wrong
On Firefox:
Move the mouse around the window in web before you click into the window. Notice the output.
Now, click into the center of the window to lock the cursor. Continue moving the mouse at the same pace. Notice that the output drastically went down.
On native, you will not be able to recreate this behavior.
For me, the bug was not present on Chromium, but other users report getting the issue only on Chrome.
Additional information
Using an extra scaling factor on Wasm is not enough, as slow mouse movements get reported as absolute zero.
This might also very well be a winit bug, I didn't investigate it independently of Bevy.
This is the output for slow mouse movement:
The cutoff to the locked state should be obvious, as the numbers go down drastically.
Note that the message saying that the mouse moved a distance of zero is collapsed as it is repeated 6(!) times.
This is the output for fast mouse movement:

Note that the amount of zeros does not go up, but the maximal distance and average distance per second are drastically lower.
The text was updated successfully, but these errors were encountered: