diff --git a/apps/openmw/mwrender/camera.cpp b/apps/openmw/mwrender/camera.cpp index 148aa33ed0..09ad404287 100644 --- a/apps/openmw/mwrender/camera.cpp +++ b/apps/openmw/mwrender/camera.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" @@ -56,7 +57,7 @@ namespace MWRender mFurthest(800.f), mIsNearest(false), mHeight(124.f), - mBaseCameraDistance(192.f), + mBaseCameraDistance(Settings::Manager::getFloat("third person camera distance", "Camera")), mVanityToggleQueued(false), mVanityToggleQueuedValue(false), mViewModeToggleQueued(false), @@ -380,7 +381,7 @@ namespace MWRender return mCameraDistance; } - void Camera::setBaseCameraDistance(float dist, bool adjust) + void Camera::updateBaseCameraDistance(float dist, bool adjust) { if(mFirstPersonView && !mPreviewMode && !mVanity.enabled) return; @@ -407,7 +408,10 @@ namespace MWRender if (mVanity.enabled || mPreviewMode) mPreviewCam.offset = dist; else if (!mFirstPersonView) + { mBaseCameraDistance = dist; + Settings::Manager::setFloat("third person camera distance", "Camera", dist); + } setCameraDistance(); } diff --git a/apps/openmw/mwrender/camera.hpp b/apps/openmw/mwrender/camera.hpp index c04bf31c24..6398f48252 100644 --- a/apps/openmw/mwrender/camera.hpp +++ b/apps/openmw/mwrender/camera.hpp @@ -119,7 +119,7 @@ namespace MWRender /// Set base camera distance for current mode. Don't work on 1st person view. /// \param adjust Indicates should distance be adjusted or set. - void setBaseCameraDistance(float dist, bool adjust = false); + void updateBaseCameraDistance(float dist, bool adjust = false); /// Set camera distance for current mode. Don't work on 1st person view. /// \param adjust Indicates should distance be adjusted or set. diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 0c6e48645b..d7549fc54e 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1340,7 +1340,7 @@ namespace MWRender if(mCamera->isNearest() && dist > 0.f) mCamera->toggleViewMode(); else if (override) - mCamera->setBaseCameraDistance(-dist / 120.f * 10, adjust); + mCamera->updateBaseCameraDistance(-dist / 120.f * 10, adjust); else mCamera->setCameraDistance(-dist / 120.f * 10, adjust); } @@ -1348,7 +1348,7 @@ namespace MWRender { mCamera->toggleViewMode(); if (override) - mCamera->setBaseCameraDistance(0.f, false); + mCamera->updateBaseCameraDistance(0.f, false); else mCamera->setCameraDistance(0.f, false); } @@ -1397,7 +1397,7 @@ namespace MWRender void RenderingManager::changeVanityModeScale(float factor) { if(mCamera->isVanityOrPreviewModeEnabled()) - mCamera->setBaseCameraDistance(-factor/120.f*10, true); + mCamera->updateBaseCameraDistance(-factor/120.f*10, true); } void RenderingManager::overrideFieldOfView(float val) diff --git a/docs/source/reference/modding/settings/camera.rst b/docs/source/reference/modding/settings/camera.rst index ecc1bda50f..20349e97fd 100644 --- a/docs/source/reference/modding/settings/camera.rst +++ b/docs/source/reference/modding/settings/camera.rst @@ -114,6 +114,17 @@ while small values can result in the hands not being visible. This setting can only be configured by editing the settings configuration file. +third person camera distance +---------------------------- + +:Type: floating point +:Range: 30-800 +:Default: 192.0 + +Distance from the camera to the character in third person mode. + +This setting can be changed in game using "Zoom In" / "Zoom Out" controls. + view over shoulder ------------------ diff --git a/files/settings-default.cfg b/files/settings-default.cfg index b044bdd5c3..1e62ff5bff 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -33,6 +33,9 @@ field of view = 60.0 # Best to leave this at the default since vanilla assets are not complete enough to adapt to high FoV's. Too low FoV would clip the hands off screen. first person field of view = 60.0 +# Distance from the camera to the character in third person mode. +third person camera distance = 192 + # If enabled then third person camera is positioned above character's shoulder and crosshair is visible. view over shoulder = false