https://github.com/nir3x/webgl-mouse-input-fix
WebGL Mouse Input Fix - Fix for High Polling Rates
https://github.com/nir3x/webgl-mouse-input-fix
godot input-fix javascript js mouse-input unity web-development webgl
Last synced: 4 months ago
JSON representation
WebGL Mouse Input Fix - Fix for High Polling Rates
- Host: GitHub
- URL: https://github.com/nir3x/webgl-mouse-input-fix
- Owner: NIR3X
- License: agpl-3.0
- Created: 2024-02-27T13:47:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-29T06:52:42.000Z (over 1 year ago)
- Last Synced: 2025-03-01T06:32:14.373Z (7 months ago)
- Topics: godot, input-fix, javascript, js, mouse-input, unity, web-development, webgl
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebGL Mouse Input Fix - Fix for High Polling Rates
This code provides a fix for the WebGL mouse input issue caused by high polling rates in browsers like Chromium. It overrides the `requestPointerLock` function to include the `unadjustedMovement` option.
## Usage
Add the following code before all scripts in your game or application's `index.html`:
```html
const oRequestPointerLock = Element.prototype.requestPointerLock;
Element.prototype.requestPointerLock = async function hkRequestPointerLock(...args) {
try {
(args[0] ||= {}).unadjustedMovement = true;
await oRequestPointerLock.apply(this, args);
} catch (err) {
console.log(err);
}
};```
## License
[](https://www.gnu.org/licenses/agpl-3.0.html)
This program is Free Software: You can use, study share and improve it at your
will. Specifically you can redistribute and/or modify it under the terms of the
[GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.html) as
published by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.