mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
OpenXR - Head control mapping when game smoothes camera movement (MH3)
This commit is contained in:
parent
7d1b50d6f9
commit
f0bfb3f373
4 changed files with 7 additions and 2 deletions
|
@ -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];
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -476,6 +476,7 @@ public:
|
|||
float fHeadUpDisplayScale;
|
||||
float fMotionLength;
|
||||
float fHeadRotationScale;
|
||||
bool bHeadRotationSmoothing;
|
||||
int iHeadRotation;
|
||||
|
||||
// Debugger
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue