diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-11-03 21:58:23 +0200 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-11-04 15:39:17 +0200 |
| commit | b22900f28db4dd69059ea059a6ecf7837c61ede3 (patch) | |
| tree | 4000c2694af843ad81632e416b04c1693d5fb669 | |
| parent | e2a741dfd2db44df1de5ad3b23de2a9aba28db2b (diff) | |
SL-3609 Fix camera POV jump when avatar crosses a region boundary
sFlycamPosition was using local coordinates instead of global ones thus
was not tracking global changes and was force setting local position to
an obsolete value.
| -rw-r--r-- | indra/newview/llviewerjoystick.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 8edb21956f..c4d87d7e16 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -36,7 +36,6 @@ #include "lltoolmgr.h" #include "llselectmgr.h" #include "llviewermenu.h" -#include "llviewerwindow.h" #include "llwindow.h" #include "llagent.h" #include "llagentcamera.h" @@ -1161,7 +1160,7 @@ void LLViewerJoystick::moveAvatar(bool reset) void LLViewerJoystick::moveFlycam(bool reset) { static LLQuaternion sFlycamRotation; - static LLVector3 sFlycamPosition; + static LLVector3d sFlycamPosition; static F32 sFlycamZoom; if (!gFocusMgr.getAppHasFocus() || mDriverState != JDS_INITIALIZED @@ -1184,7 +1183,7 @@ void LLViewerJoystick::moveFlycam(bool reset) bool in_build_mode = LLToolMgr::getInstance()->inBuildMode(); if (reset || mResetFlag) { - sFlycamPosition = LLViewerCamera::getInstance()->getOrigin(); + sFlycamPosition = gAgentCamera.getCameraPositionGlobal(); sFlycamRotation = LLViewerCamera::getInstance()->getQuaternion(); sFlycamZoom = LLViewerCamera::getInstance()->getView(); @@ -1287,7 +1286,7 @@ void LLViewerJoystick::moveFlycam(bool reset) } } - sFlycamPosition += LLVector3(sDelta) * sFlycamRotation; + sFlycamPosition += LLVector3d(sDelta[VX], sDelta[VY], sDelta[VZ]) * sFlycamRotation; LLMatrix3 rot_mat(sDelta[3], sDelta[4], sDelta[5]); sFlycamRotation = LLQuaternion(rot_mat)*sFlycamRotation; @@ -1322,7 +1321,8 @@ void LLViewerJoystick::moveFlycam(bool reset) LLMatrix3 mat(sFlycamRotation); LLViewerCamera::getInstance()->setView(sFlycamZoom); - LLViewerCamera::getInstance()->setOrigin(sFlycamPosition); + LLVector3 new_camera_pos = gAgent.getPosAgentFromGlobal(sFlycamPosition); + LLViewerCamera::getInstance()->setOrigin(new_camera_pos); LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]); LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]); LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]); |
