summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2023-06-07 18:52:22 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2023-06-07 19:49:45 +0200
commit247f6ae06f506bbafd1cb52d35bfc894f5d18180 (patch)
tree8481d16b002dc16ef8d7010ddc4531d3a3e701d4 /indra
parent45a54ba544b12ce4b27c52dd014c9b14bcb0d2c7 (diff)
SL-19286 Avatar is upside down when viewed from below
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagent.cpp26
-rw-r--r--indra/newview/llagent.h1
2 files changed, 12 insertions, 15 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 06c7cc7089..f87fa5b281 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1371,26 +1371,21 @@ LLVector3 LLAgent::getReferenceUpVector()
void LLAgent::pitch(F32 angle)
{
// don't let user pitch if pointed almost all the way down or up
- mFrameAgent.pitch(clampPitchToLimits(angle));
-}
-
-// Radians, positive is forward into ground
-//-----------------------------------------------------------------------------
-// clampPitchToLimits()
-//-----------------------------------------------------------------------------
-F32 LLAgent::clampPitchToLimits(F32 angle)
-{
// A dot B = mag(A) * mag(B) * cos(angle between A and B)
// so... cos(angle between A and B) = A dot B / mag(A) / mag(B)
// = A dot B for unit vectors
LLVector3 skyward = getReferenceUpVector();
- const F32 look_down_limit = 179.f * DEG_TO_RAD;;
- const F32 look_up_limit = 1.f * DEG_TO_RAD;
+ // SL-19286 Avatar is upside down when viewed from below
+ // after left-clicking the mouse on the avatar and dragging down
+ //
+ // The issue is observed on angle below 10 degrees
+ const F32 look_down_limit = 179.f * DEG_TO_RAD;
+ const F32 look_up_limit = 10.f * DEG_TO_RAD;
- F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
+ F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward);
// clamp pitch to limits
if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit))
@@ -1401,8 +1396,11 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
{
angle = look_up_limit - angle_from_skyward;
}
-
- return angle;
+
+ if (fabs(angle) > 1e-4)
+ {
+ mFrameAgent.pitch(angle);
+ }
}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index b8ac47827a..ea91d2b720 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -554,7 +554,6 @@ public:
void roll(F32 angle);
void yaw(F32 angle);
LLVector3 getReferenceUpVector();
- F32 clampPitchToLimits(F32 angle);
//--------------------------------------------------------------------
// Autopilot