Toggle the first-person camera with a right thumbstick click

Clicking the right thumbstick flips first person exactly as the F10
checkbox does, and saves it the same way. It works on the VR controllers
in either presentation (with a short tick on the right controller) and on
any other gamepad while VR is running. It never reached the game: SDL's
stick click only lands in Aurora's extended buttons.

A click counts on release, and only if the left thumbstick stayed up and
the headset settings panel stayed closed throughout, so the two-thumbstick
panel chord in gamepad mode never toggles the camera. A gamepad whose
right stick click is bound to a GameCube control on its port, as a button
or in an input expression, keeps it for the game. The XR side only posts
a request; the toggle itself runs on the game thread with the checkbox.

[vr] first_person_toggle_click (default true) and a checkbox under the
camera toggle turn the click off. mkw_vr_camera_toggle_tests covers the
click rule.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
iChris4andClaude Opus 5 committed 2026-09-22 15:03:17 +02:00
1 parent c11a7c9a61
commit dd7f046214
11 files changed
+245 -4

No files matched your search

+5
View File
@@ -4,6 +4,7 @@
#if defined(MKW_ENABLE_OPENXR)
#include "vr/camera_toggle.h"
#include "vr/openxr_driving.h"
#include "vr/openxr_runtime.h"
#include "vr/openxr_settings_panel.h"
@@ -64,6 +65,9 @@ struct OpenXRPointerScreen {
// the left stick's X axis in both presentations and that grip no longer reaches
// the game (C on the Nunchuk, a shoulder on the gamepad).
//
// A right-thumbstick click on its own toggles the first-person camera, as its
// F10 checkbox does (first_person_toggle_click).
//
// Left Y (both thumbsticks clicked together as a gamepad) opens the in-headset
// settings panel (openxr_settings_panel.h). While it is open, and until every
// button has been released after it closes, the game sees idle controllers: the
@@ -166,6 +170,7 @@ private:
bool m_haptics_active[kHands]{};
uint32_t m_joystick_id = 0; // SDL_JoystickID; 0 when detached
void* m_joystick = nullptr; // SDL_Joystick*
ClickToggle m_first_person_click;
SteeringWheel m_wheel;
WheelReferenceLatch m_wheel_reference;
driving::WheelVisual m_wheel_visual;