Repository navigation
arigl: clicks on windows keep the mouse, frames paced to the display, drag to steer - #988
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
CameraController::setUiRegions, which replacessetPointerOverUi).Headless Chrome, mouse look on, five move-and-click trials on the Users window (three with no pause after the move):
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: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.
CameraController::setPrimaryDragSteersis 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.beginSecondaryDrag). The page keeps the browser's context menu off the canvas.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.Checked in headless Chrome, with the avatar's facing read from the relay's room log:
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_cameragains a drag-to-steer section: the steering press, the slop, the right button, a click, the cancel, turned off from state, and mouse look.cvcgl_camera,cvcgl_camera_idleandcvcgl_camera_mappass.cvcgl_imgui_*tests,cvcgl_ari_goldenandcvcgl_streaming_overlayspass.ariadne_runtime_testpasses 248/248.Merging with #977
#977 changes
ImGuiOverlay::beginFramenext to the line this removes (setPointerOverUi). Whichever lands second keeps #977's phone rule and drops that line.