- From: Alvin Ji <notifications@github.com>
- Date: Mon, 16 Oct 2023 17:50:09 -0700
- To: w3c/pointerlock <pointerlock@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/pointerlock/pull/84@github.com>
The goal of this change is to allow application to access unadjusted mouse movement data while in Pointer Lock. This is a highly requested feature from partners in the gaming space. This change adds a PointerLockOptions object as a parameter to the requestPointerLock() method. The PointerLockOptions object currently only has one useful member which is the boolean unadjustedMovement. Also, to properly return error information and make it easier for developers to implement the requestPointerLock method was changed to return a promise. The existing Pointer Lock API returns the mouse movement that the platforms give Chrome. By default all platforms include some form of mouse acceleration in the movement information they give Chrome. Mouse acceleration is the artificial increase of velocity when the mouse is moving fast. This is useful in normal use of the pointer when a user is trying to move the mouse across the screen. However, it also makes aiming in first person perspective games very difficult. To solve this problem we are adding an option to get that unadjusted movement data when requesting pointer lock. With Pointer Lock options now available, applications need the ability to change those options while keeping the lock. This proves difficult using the previous API which fired changed or error events on the document to indicate the result of the request. Particularly troublesome was that the error event gave no reason. To solve this problem for developers a Promise workflow is being introduced. Now when requesting a change the developers can get actionable error information on rejected requests. Example: try { await element.requestPointerLock({ unadjustedMovement: true }); console.log(“pointer lock acquired”); } catch (error) { console.log(Failed to acquire pointer lock due to ${error}); } Closes https://github.com/w3c/pointerlock/issues/36 The following tasks have been completed: Modified Web platform tests (TBD) Implementation commitment: WebKit https://github.com/WebKit/WebKit/pull/17525 Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=982379) Gecko (TBD) You can view, comment on, or merge this pull request online at: https://github.com/w3c/pointerlock/pull/84 -- Commit Summary -- * merge PR#49 * remove hard link * replace <a> by shorthand syntax -- File Changes -- M index.html (680) -- Patch Links -- https://github.com/w3c/pointerlock/pull/84.patch https://github.com/w3c/pointerlock/pull/84.diff -- Reply to this email directly or view it on GitHub: https://github.com/w3c/pointerlock/pull/84 You are receiving this because you are subscribed to this thread. Message ID: <w3c/pointerlock/pull/84@github.com>
Received on Tuesday, 17 October 2023 00:50:15 UTC