Phaser API Documentation



If the browser supports it, you can request that the pointer be locked to the browser window.

This is classically known as 'FPS controls', where the pointer can't leave the browser until the user presses an exit key.

If the browser successfully enters a locked state, a POINTER_LOCK_CHANGE_EVENT will be dispatched, from the games Input Manager, with an isPointerLocked property.

It is important to note that pointer lock can only be enabled after an 'engagement gesture', see:

Note for Firefox: There is a bug in certain Firefox releases that cause native DOM events like mousemove to fire continuously when in pointer lock mode. You can get around this by setting this.preventDefaultMove to false in this class. You may also need to do the same for preventDefaultDown and/or preventDefaultUp. Please test combinations of these if you encounter the error.

Since: 3.0.0