summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-03-27 20:00:27 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-03-27 20:00:27 +0200
commitaefd01bd9cd3f8bf88231b15462abc1ccd79a7b9 (patch)
tree20b0f3f94b3680c467aaa609380576feef0c4ec0 /indra/newview
parent7b022144c787345e51579787f4a84de8c196ac43 (diff)
SL-12904 FIXED Camera Preset does not restore correctly when sitting
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentcamera.cpp12
-rw-r--r--indra/newview/llagentcamera.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index a1920f0332..bac31d48a1 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1987,13 +1987,21 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
LLVector3 LLAgentCamera::getCurrentCameraOffset()
{
- LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
+ LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~getCurrentAvatarRotation();
return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale");
}
LLVector3d LLAgentCamera::getCurrentFocusOffset()
{
- return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~gAgent.getFrameAgent().getQuaternion();
+ return (mFocusTargetGlobal - gAgent.getPositionGlobal()) * ~getCurrentAvatarRotation();
+}
+
+LLQuaternion LLAgentCamera::getCurrentAvatarRotation()
+{
+ LLViewerObject* sit_object = (LLViewerObject*)gAgentAvatarp->getParent();
+ LLQuaternion av_rot = gAgent.getFrameAgent().getQuaternion();
+ LLQuaternion obj_rot = sit_object ? sit_object->getRenderRotation() : LLQuaternion::DEFAULT;
+ return av_rot * obj_rot;
}
bool LLAgentCamera::isJoystickCameraUsed()
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index a9f57cf956..357dd5e12a 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -119,6 +119,7 @@ public:
LLVector3 getCurrentCameraOffset();
LLVector3d getCurrentFocusOffset();
+ LLQuaternion getCurrentAvatarRotation();
bool isJoystickCameraUsed();
private: