diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index a22680d1a3..f3ede39317 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -322,14 +322,15 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) { // calculate delta angles of the rotation if (isVR) { + float f = g_Config.bHeadRotationSmoothing ? 0.5f : 1.0f; float deltaPitch = pitch - hmdMotionLast[0]; float deltaYaw = yaw - hmdMotionLast[1]; while (deltaYaw >= 180) deltaYaw -= 360; while (deltaYaw < -180) deltaYaw += 360; hmdMotionLast[0] = pitch; hmdMotionLast[1] = yaw; - hmdMotionDiffLast[0] = hmdMotionDiff[0]; - hmdMotionDiffLast[1] = hmdMotionDiff[1]; + hmdMotionDiffLast[0] = hmdMotionDiffLast[0] * (1-f) + hmdMotionDiff[0] * f; + hmdMotionDiffLast[1] = hmdMotionDiffLast[1] * (1-f) + hmdMotionDiff[1] * f; hmdMotionDiff[0] += deltaPitch; hmdMotionDiff[1] += deltaYaw; pitch = hmdMotionDiff[0]; diff --git a/Core/Config.cpp b/Core/Config.cpp index 17b5c36b25..7544681413 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1198,6 +1198,7 @@ static ConfigSetting vrSettings[] = { ConfigSetting("VRHeadUpDisplayScale", &g_Config.fHeadUpDisplayScale, 0.3f), ConfigSetting("VRMotionLength", &g_Config.fMotionLength, 0.5f), ConfigSetting("VRHeadRotationScale", &g_Config.fHeadRotationScale, 5.0f), + ConfigSetting("VRHeadRotationSmoothing", &g_Config.bHeadRotationSmoothing, false), ConfigSetting("VRHeadRotation", &g_Config.iHeadRotation, 0), ConfigSetting(false), diff --git a/Core/Config.h b/Core/Config.h index ab57955346..bd4a021f29 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -476,6 +476,7 @@ public: float fHeadUpDisplayScale; float fMotionLength; float fHeadRotationScale; + bool bHeadRotationSmoothing; int iHeadRotation; // Debugger diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 897d84ad3e..066a2f49c2 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1089,6 +1089,8 @@ void GameSettingsScreen::CreateViews() { vrSettings->Add(new PopupMultiChoice(&g_Config.iHeadRotation, vr->T("Map HMD rotations on keys instead of VR camera"), vrHeadRotations, 0, ARRAY_SIZE(vrHeadRotations), vr->GetName(), screenManager())); PopupSliderChoiceFloat *vrHeadRotationScale = vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fHeadRotationScale, 0.1f, 10.0f, vr->T("Game camera rotation step per frame"), 0.1f, screenManager(), "°")); vrHeadRotationScale->SetEnabledFunc([&] { return g_Config.iHeadRotation > 0; }); + CheckBox *vrHeadRotationSmoothing = vrSettings->Add(new CheckBox(&g_Config.bHeadRotationSmoothing, vr->T("Game camera uses rotation smoothing"))); + vrHeadRotationSmoothing->SetEnabledFunc([&] { return g_Config.iHeadRotation > 0; }); vrSettings->Add(new CheckBox(&g_Config.bEnableMotions, vr->T("Map controller movements to keys"))); PopupSliderChoiceFloat *vrMotions = vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fMotionLength, 0.3f, 1.0f, vr->T("Motion needed to generate action"), 0.1f, screenManager(), vr->T("m"))); vrMotions->SetEnabledPtr(&g_Config.bEnableMotions);