summaryrefslogtreecommitdiff
path: root/indra/newview/llagentcamera.cpp
diff options
context:
space:
mode:
authorEuclid Linden <euclid@lindenlab.com>2021-04-01 21:45:41 +0000
committerEuclid Linden <euclid@lindenlab.com>2021-04-01 21:45:41 +0000
commitcaabb384bdb5d0d78023d1d9fd155838f022c186 (patch)
tree3b98591209c59c8e08abd3d330285ef6f4eb6b56 /indra/newview/llagentcamera.cpp
parentebadc409de90c75f96a005e8f45a3eee4ad243e0 (diff)
parent98580cd85ca77a3e405756d1354a449c3347d13d (diff)
Merged in DV528-merge-6.4.18 (pull request #512)
DRTVWR-528 merge up to 6.4.18
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-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 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);
}
}
}