Skip to content

arigl: clicks on windows keep the mouse, frames paced to the display, drag to steer - #988

Merged
transfix merged 1 commit into
masterfrom
fix/arigl-look-steer
Nov 3, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/arigl-look-steer

Conversation

@transfix

@transfix transfix commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Three things from trying the browser conference with mouse look on: a click on a window took the mouse, looking around was jagged, and click-to-face should also work as a drag, with a mouse or a finger.

A click on a window no longer takes the mouse

The page takes its pointer lock inside the press itself (a browser may refuse a request made later). It decided "this press is not on the UI" from a flag the frame loop set from ImGui's hover, which is a frame or two old. A move onto a window followed quickly by a click therefore locked the mouse.

  • The overlay now hands the camera the rectangles of the windows it drew (CameraController::setUiRegions, which replaces setPointerOverUi).
  • The page tests the press's own position against those rectangles.
  • The overlay also keeps a press inside a window from the camera, even before ImGui has seen the pointer arrive.

Headless Chrome, mouse look on, five move-and-click trials on the Users window (three with no pause after the move):

lock requests from 5 clicks on Users click on the floor
before (the deployed page) 3 locks
after 0 locks

Frames are paced to the display

arigl's browser loop yielded on a 0 ms timer, out of step with the display, so frames stayed up for 0, 1 or 2 refreshes unevenly. That's the same judder cvcdbg's demo3 had on a 144 Hz screen. The loop now waits for the next animation frame. In a hidden tab, a 100 ms timer keeps the loop and the room's link going.

?yield=timeout ($CVC_ARIGL_YIELD) brings back the old timer for comparison. Headless Chrome at 60 Hz, same build, one Chrome at a time, 6 s each, frames drawn per display refresh:

1 frame 2 frames (one never shown) 0 frames (old frame held)
animation frame (new) 375 / 376, 374 / 375 0 1
0 ms timer (old) 323 / 386, 308 / 384 44, 58 19, 18

The pointer lock also asks for the mouse's raw motion (unadjustedMovement): no pointer acceleration, and none of the jumps Chromium's adjusted motion can have under a lock. A browser without raw motion gets the plain lock.

Drag to steer, by mouse or by touch

In drag to look, a drag on the floor now turns the avatar to face the point under the pointer as it moves.

  • The switch. CameraController::setPrimaryDragSteers is on in a room, and the Controls window has a checkbox for it: Drag the floor to face it (right drag looks around), or (two fingers look around) on a touch screen.
  • When a drag starts. Only once the pointer is past the 4 px click slop, so a click is still a click.
  • Turning the view. The right button does it with a mouse, and so do two fingers on a phone (beginSecondaryDrag). The page keeps the browser's context menu off the canvas.
  • A second finger. It cancels the first one's press (CameraController::cancelPointer), so a two-finger turn neither steers nor ends as a tap on the floor. Chrome delivers two fingers as two touchstarts, the first one alone. That alone press used to reach the camera, so before this a two-finger gesture could also end as a click that turned the avatar.
  • Turn rate. Drag turns are rate-limited like mouse look's: up to 20 a second go to the relay, while your own avatar turns every frame.

Checked in headless Chrome, with the avatar's facing read from the relay's room log:

step facing at the relay the view
start 0.0
left drag to the right 7.5 0 floor pixels changed
left drag to the left -82.4 0 floor pixels changed
right drag -82.4 turned

As a phone (390x844 CSS px at pixel ratio 3, real touch events): a one-finger drag steers, and a two-finger drag turns the view without turning the avatar.

Tests

  • cvcgl_camera gains a drag-to-steer section: the steering press, the slop, the right button, a click, the cancel, turned off from state, and mouse look.
  • The Controls window test checks the new row.
  • Results:
    • cvcgl_camera, cvcgl_camera_idle and cvcgl_camera_map pass.
    • The cvcgl_imgui_* tests, cvcgl_ari_golden and cvcgl_streaming_overlays pass.
    • ariadne_runtime_test passes 248/248.

Merging with #977

#977 changes ImGuiOverlay::beginFrame next to the line this removes (setPointerOverUi). Whichever lands second keeps #977's phone rule and drops that line.

… drag to steer

Three things from trying cyprty with mouse look on.

A click on a window could take the pointer. The page takes its pointer
lock inside the press, and it judged "not on the UI" by a flag the frame
loop set from ImGui's hover, a frame or two old: a move onto a window and
a click within that time locked the mouse (3 of 5 such clicks in headless
Chrome). The overlay now hands the camera the rectangles of the windows it
drew (CameraController::setUiRegions, replacing setPointerOverUi), the
page tests the press's own position against them, and the overlay keeps a
press there from the camera even before ImGui has seen the pointer arrive.
After: 0 of 5, and a click on the floor still locks.

Looking around was jagged. arigl's browser loop yielded on a 0 ms timer,
out of step with the display, so frames stayed up for 0, 1 or 2 refreshes
unevenly: in headless Chrome at 60 Hz, 44-58 of ~385 refreshes got two
frames (one never shown) and 18-19 none. It now waits for the next
animation frame (a 100 ms timer keeps a hidden tab's loop going): 374-375
of ~375 refreshes get exactly one. ?yield=timeout ($CVC_ARIGL_YIELD) is
the A/B. The pointer lock also asks for raw motion (unadjustedMovement:
no pointer acceleration, none of Chromium's jumps under a lock), and takes
the plain lock where a browser has none.

In drag to look, a drag on the floor now steers: the avatar faces the
point under the pointer as it moves, mouse or finger
(CameraController::setPrimaryDragSteers, on in a room; a drag starts
past the 4 px click slop). The right button, or two fingers, turns the
view instead; the browser's context menu is kept off the canvas. A second
finger cancels the first one's press (CameraController::cancelPointer),
so a two-finger turn neither steers nor ends as a tap on the floor. Turns
from a drag are rate-limited like mouse look's (20 a second to the relay,
every frame on screen). The Controls window has the switch: "Drag the
floor to face it (right drag / two fingers look around)".

Tests: cvcgl_camera gains a drag-to-steer section (slop, right drag,
click, cancel, off from state, mouse look); the Controls window test
checks the new row. cvcgl_camera*, cvcgl_imgui_*, ari_golden,
streaming_overlays 13/13, ariadne_runtime 248/248.
@transfix
transfix merged commit d5c1f64 into master Nov 3, 2026
28 checks passed
@transfix
transfix deleted the fix/arigl-look-steer branch November 3, 2026 10:06
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