18 Pointer Lock. 18 of 95.
18/GESTURE PHYSICS/18 of 95
Pointer Lock
Relative movement can replace cursor position.
Best experienced with a pointer.
The problem
Absolute cursor coordinates stop at the screen edge, so aim and camera control die the moment the pointer hits the bezel.
The solution
After lock, aim integrates relative movement deltas so travel continues unbounded past the edge.
Experiment
Play with the values
1
How it works
- Pointer lock is requested so the page receives movement instead of a cursor position.
- The operating-system cursor hides because position on screen no longer matters.
- movementX and movementY are the input, including motion that would have hit the screen edge.
- Those deltas integrate into a virtual aim that is not clamped to the viewport.
- Aim continues past the screen edge, which is what relative controls such as cameras need.
Seen in
FPS games
Look and aim keep turning after the mouse reaches the monitor edge.
3D editors
Orbit and fly-through cameras use relative deltas while the cursor is locked.
Drawing canvases
Some tools lock the pointer for continuous brush or camera gestures.
Simulators
Cockpit and vehicle views stay under control without chasing a visible cursor.