SL-13802 Avatar was turned into wrong direction when hitting esc

meow-7.2.2
Andrey Kleshchev 2020-08-19 00:05:00 +03:00
parent c3b1eadf88
commit c98bef9717
1 changed files with 13 additions and 4 deletions

View File

@ -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);
}
}
}