demo · v144

Orbit Controls

A 3D viewer control surface for the Android pointer-lock port. Request lock for raw relative mouse motion, tune the orbit response, and force the touch fallback path used when an Android device has no attached mouse or trackpad.

Pointer Lock API: checking… input path: checking… lock state: unlocked

checking input hardware…

Click request lock for infinite mouse deltas. In fallback mode, drag here with touch or a pointer.

yaw-25 deg
pitch35 deg
last delta0, 0
motion events0
lock attempts0
lock failures0
Idle. Request pointer lock, or force fallback mode to test touch-style orbiting.

the API

await arena.requestPointerLock({ unadjustedMovement: true });

document.addEventListener("pointerlockchange", () => {
  locked = document.pointerLockElement === arena;
});
document.addEventListener("pointerlockerror", showFailure);
document.addEventListener("mousemove", (event) => {
  if (document.pointerLockElement === arena) {
    orbit(event.movementX, event.movementY);
  }
});

// Touch-only Android devices stay useful through a normal drag fallback.
arena.addEventListener("pointermove", orbitFromClientCoordinates);

see also