Skip to content

camera: first-person mouse look (turn in place, move along the aim) - #1212

Merged
transfix merged 2 commits into
masterfrom
fix/mouse-look-fly
Nov 14, 2026
Merged

transfix merged 2 commits into
masterfrom
fix/mouse-look-fly

Conversation

@transfix

Copy link
Copy Markdown
Owner

Joe: mouse look is wrong. It should yaw and pitch the camera where it stands; forward/back move along the camera's forward vector, left/right strafe in a plane parallel to the terrain (no roll yet).

What was wrong. Mouse look in Orbit (the Controls window's "Mouse look", how the terrain lab opens) turned the orbit about its centre, a third-person camera: the mouse swung the eye around a point far ahead, and W/A/S/D slid the orbit centre across the ground. The orbit's elevation range also stopped the look at the horizon.

Now, by default (first person):

  • The mouse sets the eye's yaw (about the world's up) and pitch; the eye stays where it is (the orbit centre moves around it).
  • W/S move the eye along the way it looks, pitch included. A/D strafe across it in the ground's plane. Space/Ctrl rise and sink along the world's up, at the move speed (Shift sprints).
  • The look goes to ±89° whatever the orbit's elevation range. An orbit drag that then starts outside the range moves toward it instead of snapping.
  • Turning mouse look off orbits a point ahead of the eye, as before.

arigl's avatar room keeps the third-person camera behind its avatar through the new CameraController::setMouseLookOrbits(true) (state settings.mouse_look_orbits). Fly already moved this way and is unchanged.

Tests (local MSVC Release, all pass): cvcgl_camera (section M rewritten for first person: the eye stays put, right turns right, up looks up, no elevation clamp, no snap on a later drag; the third-person checks kept under setMouseLookOrbits(true); section Q adds W moving 5 m along the 3-D look, D strafing level, Space rising), cvcgl_camera_idle, cvcgl_camera_map, cvcgl_camera_sdl_fly, ariadne_runtime_test.

Not checked: a real browser's pointer lock (headless Chrome refuses it).

Mouse look in Orbit turned the orbit about its centre, a third-person camera,
so the mouse swung the eye round a far-off point and the keys slid the view
across the ground. Now, by default, the eye stays where it is and the mouse
sets its yaw (about the world's up) and pitch; W/S move it along the way it
looks, A/D strafe across it in the ground's plane, Space/Ctrl rise and sink,
at the move speed, as in Fly. The orbit's elevation range no longer stops the
look at the horizon, and an orbit drag that starts outside the range moves
toward it instead of snapping.

arigl's room keeps the third-person camera behind its avatar through the new
setMouseLookOrbits(true) (state settings.mouse_look_orbits).
@transfix
transfix enabled auto-merge (squash) November 13, 2026 02:16
@transfix
transfix merged commit 49b60b8 into master Nov 14, 2026
30 of 33 checks passed
@transfix
transfix deleted the fix/mouse-look-fly branch November 14, 2026 00:12
transfix added a commit that referenced this pull request Nov 14, 2026
…#1177, #1167) into perf/threaded-s1b

The one conflict is the sanitizers' SAN_CXX_TESTS list in ci.yml: this branch added
stream_test, net_ws_client_test and ariadne_host_test, and #1167 added skeleton_test. The
list keeps all four.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant