diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-01 21:34:44 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-04-01 21:34:44 +0300 |
commit | 4c889f7e5252d8c82b0ffc3e13af5bf5d32a6047 (patch) | |
tree | 7cd047318bfd924ee2381409841f01d9284aca46 /indra/newview/llagentcamera.cpp | |
parent | 6dbde938e2c72259e941b10fe0a96ba196c95de9 (diff) | |
parent | 167e45e309ebeaccb346b8ca05884b8e10bf05eb (diff) |
Merge branch 'master' (DRTVWR-514) into DRTVWR-518-ui
# Conflicts:
# indra/newview/skins/default/xui/en/menu_viewer.xml SL-12494 vs SL-15034
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-rw-r--r-- | indra/newview/llagentcamera.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 672104dd70..ed6c3c307f 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2702,10 +2702,19 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate, BOOL re LLVector3 at_axis; if (!isAgentAvatarValid() || !gAgentAvatarp->getParent()) { - at_axis = LLViewerCamera::getInstance()->getAtAxis(); - at_axis.mV[VZ] = 0.f; - at_axis.normalize(); - gAgent.resetAxes(at_axis); + // In case of front view rotate agent to look into direction opposite to camera + // In case of rear view rotate agent into diraction same as camera, e t c + LLVector3 vect = getCameraOffsetInitial(); + F32 rotxy = F32(atan2(vect.mV[VY], vect.mV[VX])); + + LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); + // front view angle rotxy is zero, rear view rotxy angle is 180, compensate + frameCamera.yaw((180 * DEG_TO_RAD) - rotxy); + at_axis = frameCamera.getAtAxis(); + at_axis.mV[VZ] = 0.f; + at_axis.normalize(); + gAgent.resetAxes(at_axis); + gAgent.yaw(0); } } } |