diff options
| author | leviathan <leviathan@lindenlab.com> | 2026-09-24 16:04:55 -0700 |
|---|---|---|
| committer | leviathan <leviathan@lindenlab.com> | 2026-10-16 13:14:38 -0700 |
| commit | dfca45c8ae47ef1f56ef0af591a8f456fcd64784 (patch) | |
| tree | beaa98f300550e63a5f79a90d94e82cd153d10df /indra/newview/llagent.cpp | |
| parent | f9f14adc36f792d1f885a421f888a93a8072873f (diff) | |
add 'scroll' game-control action for changing follocam dist
Diffstat (limited to 'indra/newview/llagent.cpp')
| -rw-r--r-- | indra/newview/llagent.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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); |
