diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llagentcamera.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llagentcamera.h | 1 |
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: |