Skip to content
Snippets Groups Projects
Commit aefd01bd authored by Mnikolenko Productengine's avatar Mnikolenko Productengine
Browse files

SL-12904 FIXED Camera Preset does not restore correctly when sitting

parent 7b022144
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
......@@ -119,6 +119,7 @@ class LLAgentCamera
LLVector3 getCurrentCameraOffset();
LLVector3d getCurrentFocusOffset();
LLQuaternion getCurrentAvatarRotation();
bool isJoystickCameraUsed();
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment