From dfca45c8ae47ef1f56ef0af591a8f456fcd64784 Mon Sep 17 00:00:00 2001 From: leviathan Date: Thu, 24 Sep 2026 16:04:55 -0700 Subject: add 'scroll' game-control action for changing follocam dist --- indra/newview/llagent.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llagent.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 7dd11e85bc..443b64ea99 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5320,6 +5320,18 @@ void LLAgent::applyExternalActions(const LLGameControl::AgentActions& actions) gSavedSettings.setF32("CameraAngle", camera->getView()); } + // actions.mScrollAmplitude ([-1, 1], from "Scroll +/-"/"Scroll +"/"Scroll -") + // moves the camera toward/away from the avatar the same way the mousewheel does, + // so the third-person/follow-cam distance persists once the avatar moves (unlike + // the keyboard's camera in/out keys, which unlock the view from the avatar). + // Positive amplitude scrolls in (camera moves closer); scrollCamera()'s clicks + // are positive-out like the mousewheel's. + if (actions.mScrollAmplitude != 0.f) + { + constexpr F32 SCROLL_CLICKS_PER_SECOND = 8.f; + gAgentCamera.scrollCamera(-actions.mScrollAmplitude * SCROLL_CLICKS_PER_SECOND * g_deltaTime); + } + if (mExternalActionFlags & AGENT_CONTROL_STOP) { setControlFlags(AGENT_CONTROL_STOP); -- cgit v1.3