Locks the mouse pointer to its current position and makes it invisible.
requestPointerLock() allows the mouse to move forever without leaving the screen. Calling requestPointerLock() locks the values of mouseX, mouseY, pmouseX, and pmouseY. movedX and movedY continue updating and can be used to get the distance the mouse moved since the last frame was drawn. Calling exitPointerLock() resumes updating the mouse system variables.
Note: Most browsers require an input, such as a click, before calling requestPointerLock(). It’s recommended to call requestPointerLock() in an event function such as doubleClicked().
Ejemplos
Referencias Relacionadas
doubleClicked
Una función que se ejecuta una vez cuando el botón del mouse se hace doble click rápidamente.
exitPointerLock
Sale de un bloqueo de puntero iniciado con requestPointerLock.
mouseButton
Una variable de tipo String del sistema que contiene el valor del último botón del mouse presionado.
mouseClicked
Una función que se ejecuta una vez después de que se presiona y se suelta un botón del mouse.