summaryrefslogtreecommitdiff
path: root/indra/newview/llagentcamera.cpp
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2020-03-16 17:48:23 +0200
committermaxim_productengine <mnikolenko@productengine.com>2020-03-16 17:48:23 +0200
commit3e403ffb4f6d295b11c9842bed53df5d15848f0b (patch)
tree3d7578891875c01cac14210fccccc94942f4ec07 /indra/newview/llagentcamera.cpp
parentafd45506c12c93ff4b705d72de249005b9c27944 (diff)
SL-4495 Add setting to ignore Hover height when setting Camera position
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-rw-r--r--indra/newview/llagentcamera.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 6b1dd4c3c3..a1920f0332 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1730,7 +1730,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
F32 camera_land_height;
LLVector3d frame_center_global = !isAgentAvatarValid() ?
gAgent.getPositionGlobal() :
- gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition());
+ gAgent.getPosGlobalFromAgent(getAvatarRootPosition());
BOOL isConstrained = FALSE;
LLVector3d head_offset;
@@ -1987,7 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
LLVector3 LLAgentCamera::getCurrentCameraOffset()
{
- LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->mRoot->getWorldPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
+ LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale");
}
@@ -2019,6 +2019,12 @@ F32 LLAgentCamera::getCameraMaxZoomDistance()
LLWorld::getInstance()->getRegionWidthInMeters() - CAMERA_FUDGE_FROM_OBJECT);
}
+LLVector3 LLAgentCamera::getAvatarRootPosition()
+{
+ static LLCachedControl<bool> use_hover_height(gSavedSettings, "HoverHeightAffectsCamera");
+ return use_hover_height ? gAgentAvatarp->mRoot->getWorldPosition() : gAgentAvatarp->mRoot->getWorldPosition() - gAgentAvatarp->getHoverOffset();
+
+}
//-----------------------------------------------------------------------------
// handleScrollWheel()
//-----------------------------------------------------------------------------