1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 04:15:31 +00:00

Head/hand directed movement option

This commit is contained in:
Mads Buvik Sandvei 2020-08-08 12:24:24 +02:00
parent 89ff075936
commit 2a534877da
3 changed files with 19 additions and 11 deletions

View file

@ -41,6 +41,7 @@ namespace MWVR
VRSession::VRSession() VRSession::VRSession()
: mXrSyncPhase{FramePhase::Cull} : mXrSyncPhase{FramePhase::Cull}
{ {
mHandDirectedMovement = Settings::Manager::getBool("hand directed movement", "VR");
auto syncPhase = Settings::Manager::getString("openxr sync phase", "VR"); auto syncPhase = Settings::Manager::getString("openxr sync phase", "VR");
syncPhase = Misc::StringUtils::lowerCase(syncPhase); syncPhase = Misc::StringUtils::lowerCase(syncPhase);
if (syncPhase == "update") if (syncPhase == "update")
@ -306,21 +307,24 @@ namespace MWVR
{ {
if (!getFrame(FramePhase::Update)) if (!getFrame(FramePhase::Update))
beginPhase(FramePhase::Update); beginPhase(FramePhase::Update);
auto frameMeta = getFrame(FramePhase::Update).get(); if (mHandDirectedMovement)
{
auto frameMeta = getFrame(FramePhase::Update).get();
float headYaw = 0.f; float headYaw = 0.f;
float headPitch = 0.f; float headPitch = 0.f;
float headsWillRoll = 0.f; float headsWillRoll = 0.f;
float handYaw = 0.f; float handYaw = 0.f;
float handPitch = 0.f; float handPitch = 0.f;
float handRoll = 0.f; float handRoll = 0.f;
getEulerAngles(frameMeta->mPredictedPoses.head.orientation, headYaw, headPitch, headsWillRoll); getEulerAngles(frameMeta->mPredictedPoses.head.orientation, headYaw, headPitch, headsWillRoll);
getEulerAngles(frameMeta->mPredictedPoses.hands[(int)Side::LEFT_SIDE].orientation, handYaw, handPitch, handRoll); getEulerAngles(frameMeta->mPredictedPoses.hands[(int)Side::LEFT_SIDE].orientation, handYaw, handPitch, handRoll);
yaw = handYaw - headYaw; yaw = handYaw - headYaw;
pitch = handPitch - headPitch; pitch = handPitch - headPitch;
}
} }
} }

View file

@ -83,6 +83,7 @@ namespace MWVR
std::condition_variable mCondition{}; std::condition_variable mCondition{};
FramePhase mXrSyncPhase{ FramePhase::Cull }; FramePhase mXrSyncPhase{ FramePhase::Cull };
bool mHandDirectedMovement{ false };
bool mUseSteadyClock{ false }; bool mUseSteadyClock{ false };
long long mFrames{ 0 }; long long mFrames{ 0 };
long long mLastRenderedFrame{ 0 }; long long mLastRenderedFrame{ 0 };

View file

@ -942,3 +942,6 @@ log all openxr calls = false
# If false, openmw will quit with an exception if an openxr call fails for any reason # If false, openmw will quit with an exception if an openxr call fails for any reason
continue on errors = true continue on errors = true
# If true, movement direction is taken from the left hand tracker, instead of your head.
hand directed movement = false