Skip to main content

Pointer Lock

Clicking on the game will lock the pointer to the game. This is useful for games that require the mouse to be locked, such as first-person shooters.

this.world.addSystem(new TMouseInputSystem(this.world, engine.inputManager));
this.world.addSystem(new PointerLockSystem(this.world));
engine.inputManager.enablePointerLock();

// In PointerLockSystem, use mouseMovement on an entity with TMouseInputComponent.
const movement = world.getComponent(
entity,
)?.mouseMovement;