summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-08-19 00:05:00 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-08-19 00:05:38 +0300
commitc98bef9717a5ac70e0fe92bd217dbfc9c4094b0d (patch)
tree494f0abf216a2562526edeb4495d442ada13ec07 /indra
parentc3b1eadf88c380bf932f89c541d0ac60da617256 (diff)
SL-13802 Avatar was turned into wrong direction when hitting esc
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagentcamera.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 9e65409256..c9d2b8305a 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2690,10 +2690,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);
}
}
}