Motivation
Providing the { unadjustedMovement: true } option while calling requestPointerLock causes subsequent mouse move events to bypass the OS's mouse acceleration and sensitivity. This is useful for a couple reasons.
- Many games would rather access raw mouse input, especially for controlling first-person camera movement, so that input acceleration can be disabled or controlled.
- There is a longstanding Chrome bug where the occasional mouse movement event has an incorrect, very large delta value which causes the cursor to "teleport". Setting unadjustedMovement to true is a workaround for this.
Proposed Solution
The spec for pointer lock options is unstable so it makes sense to mark this with the unstable flag.
This WebIDL is a start:
dictionary PointerLockOptions {
boolean unadjustedMovement = false;
};
partial interface Element {
[NeedsCallerType]
Promise<undefined> requestPointerLock(optional PointerLockOptions options = {});
};
but there are currently 2 issues I'm encountering with this solution.
- Since
requestPointerLock is already a stable feature, this generates 2 functions with the same name. Is there a way to override an existing function in unstable?
- requestPointerLock returns
undefined on unsupported browsers but Promise<undefined>? returns a parsing error. Any ideas why would this wouldn't work even though there are other functions that return optional values?
Any advice on these issues is welcome!
Motivation
Providing the
{ unadjustedMovement: true }option while callingrequestPointerLockcauses subsequent mouse move events to bypass the OS's mouse acceleration and sensitivity. This is useful for a couple reasons.Proposed Solution
The spec for pointer lock options is unstable so it makes sense to mark this with the unstable flag.
This WebIDL is a start:
but there are currently 2 issues I'm encountering with this solution.
requestPointerLockis already a stable feature, this generates 2 functions with the same name. Is there a way to override an existing function in unstable?undefinedon unsupported browsers butPromise<undefined>?returns a parsing error. Any ideas why would this wouldn't work even though there are other functions that return optional values?Any advice on these issues is welcome!