diff --git a/android/app/src/main/cpp/code/cgame/cg_draw.c b/android/app/src/main/cpp/code/cgame/cg_draw.c index f12b5223..bfb54a96 100644 --- a/android/app/src/main/cpp/code/cgame/cg_draw.c +++ b/android/app/src/main/cpp/code/cgame/cg_draw.c @@ -2603,7 +2603,8 @@ static void CG_DrawVignette( void ) return; } - if (VectorLength(cg.predictedPlayerState.velocity) > 30.0 || vr->smooth_turning) + const float yawDelta = abs(vr->clientview_yaw_delta); + if (VectorLength(cg.predictedPlayerState.velocity) > 30.0 || (yawDelta > 0 && yawDelta < 20) || (yawDelta > 340)) { if (currentComfortVignetteValue < comfortVignetteValue) { diff --git a/android/app/src/main/cpp/code/vr/vr_clientinfo.h b/android/app/src/main/cpp/code/vr/vr_clientinfo.h index f7f4b18b..0ddf493e 100644 --- a/android/app/src/main/cpp/code/vr/vr_clientinfo.h +++ b/android/app/src/main/cpp/code/vr/vr_clientinfo.h @@ -19,12 +19,13 @@ typedef struct { vrFollowMode_t follow_mode; qboolean weapon_select; qboolean weapon_select_autoclose; - qboolean smooth_turning; int realign; // used to realign the fake 6DoF playspace in a multiplayer game int clientNum; vec3_t clientviewangles; //orientation in the client - we use this in the cgame + float clientview_yaw_last; // Don't use this, it is just for calculating delta! + float clientview_yaw_delta; vec3_t hmdposition; vec3_t hmdorigin; //used to recenter the mp fake 6DoF playspace diff --git a/android/app/src/main/cpp/code/vr/vr_input.c b/android/app/src/main/cpp/code/vr/vr_input.c index aca9e488..855b66f2 100644 --- a/android/app/src/main/cpp/code/vr/vr_input.c +++ b/android/app/src/main/cpp/code/vr/vr_input.c @@ -291,11 +291,6 @@ static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboole } CL_SnapTurn(-snap); } else { // yaw (smooth turn) - // TODO How to disable this once enabled? - // (In this method i do not know to which button it is assigned and - // since i need to invoke the button repeatedly, i will not receive - // the "pressed=false" event) - // vr.smooth_turning = true; float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value; Com_QueueEvent(in_vrEventTime, SE_MOUSE, -value, 0, 0, NULL); return qtrue; @@ -308,11 +303,6 @@ static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboole } CL_SnapTurn(snap); } else { // yaw (smooth turn) - // TODO How to disable this once enabled? - // (In this method i do not know to which button it is assigned and - // since i need to invoke the button repeatedly, i will not receive - // the "pressed=false" event) - // vr.smooth_turning = true; float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value; Com_QueueEvent(in_vrEventTime, SE_MOUSE, value, 0, 0, NULL); return qtrue; @@ -1164,6 +1154,11 @@ void IN_VRInputFrame( void ) //Keep this for our records VectorCopy(vr.hmdorientation, vr.hmdorientation_last); + + // View yaw delta + const float clientview_yaw = vr.clientviewangles[YAW] - vr.hmdorientation[YAW]; + vr.clientview_yaw_delta = vr.clientview_yaw_last - clientview_yaw; + vr.clientview_yaw_last = clientview_yaw; }