emscripten-core / emscripten-core/emscripten

[Feature request] raw mouse input, no acceleration, with `requestPointerLock({ unadjustedMovement: true })`

Open
#24,602 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
3.1.58

This affects shooter games especially. Chromium introduced the [`unadjustedMovement`](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestPointerLock#unadjustedmovement) parameter not so long ago, which makes aiming so so much better, indistinguishable from running a native game.

There is an example of an app, Quake III Arena, that utilizes Emscripten with a hack to get it to use `unadjustedMovement`:

https://github.com/jdarpinian/ioq3/blob/7801abd5ac510a889087ad62473c54dbe509e106/code/web/index.html#L301-L322

It can be tested here: https://thelongestyard.link/

However, I believe that this should be upstreamed to Emscripten itself. Perhaps with a config option, if needed.

As of 2025-06 it's only supported on Windows and macOS, however, and its support needs to be detected, perhaps with `try { await canvas.requestPointerLock({ unadjustedMovement: true }) catch ...`.
Also note that this parameter is considered experimental.

I wanted to try to make an MR, but I am not sure where exactly this needs to be changed (there is [a lot of](https://github.com/search?q=repo%3Aemscripten-core%2Femscripten+requestPointerLock&type=code) `requestPointerLock` references), and how to handle the fact that this option might not be supported.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.