From e8250ffdbf3343d71278741e66484fdca46a653a Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 26 Jan 2021 22:52:39 +0000 Subject: [PATCH] Corrected positional movement on Quest 2 --- Projects/Android/AndroidManifest.xml | 4 ++-- Projects/Android/jni/src/Lambda1VR/L1VR_SurfaceView.c | 6 ++++-- Projects/Android/jni/src/Lambda1VR/VrInput.h | 2 ++ Projects/Android/jni/src/Lambda1VR/VrInputDefault.c | 3 ++- .../Android/jni/src/Xash3D/xash3d/engine/common/build.c | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index c4fcb6a..3f816a0 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="27" + android:versionName="1.4.9" android:installLocation="auto" > diff --git a/Projects/Android/jni/src/Lambda1VR/L1VR_SurfaceView.c b/Projects/Android/jni/src/Lambda1VR/L1VR_SurfaceView.c index 3d6ea10..81361ac 100644 --- a/Projects/Android/jni/src/Lambda1VR/L1VR_SurfaceView.c +++ b/Projects/Android/jni/src/Lambda1VR/L1VR_SurfaceView.c @@ -1476,8 +1476,10 @@ void * AppThreadFunction( void * parm ) m_width=vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH ) * SS_MULTIPLIER; m_height=m_width; + hmdType = vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE); - ovrEgl_CreateContext( &appState.Egl, NULL ); + + ovrEgl_CreateContext( &appState.Egl, NULL ); EglInitExtensions(); @@ -1645,7 +1647,7 @@ void * AppThreadFunction( void * parm ) #endif //Set 90hz mode for Quest 2 - if (vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE) == VRAPI_DEVICE_TYPE_OCULUSQUEST2) { + if (hmdType == VRAPI_DEVICE_TYPE_OCULUSQUEST2) { vrapi_SetDisplayRefreshRate(appState.Ovr, 90); } diff --git a/Projects/Android/jni/src/Lambda1VR/VrInput.h b/Projects/Android/jni/src/Lambda1VR/VrInput.h index 4181296..21125c5 100644 --- a/Projects/Android/jni/src/Lambda1VR/VrInput.h +++ b/Projects/Android/jni/src/Lambda1VR/VrInput.h @@ -26,6 +26,8 @@ float positional_movementSideways; float positional_movementForward; float snapTurn; +int hmdType; + void sendButtonAction(const char* action, long buttonDown); void sendButtonActionSimple(const char* action); diff --git a/Projects/Android/jni/src/Lambda1VR/VrInputDefault.c b/Projects/Android/jni/src/Lambda1VR/VrInputDefault.c index 65c8e7c..b1f763c 100644 --- a/Projects/Android/jni/src/Lambda1VR/VrInputDefault.c +++ b/Projects/Android/jni/src/Lambda1VR/VrInputDefault.c @@ -309,7 +309,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, { //This section corrects for the fact that the controller actually controls direction of movement, but we want to move relative to the direction the //player is facing for positional tracking - float multiplier = vr_positional_factor->value / (cl_forwardspeed->value * + float factor = (hmdType == VRAPI_DEVICE_TYPE_OCULUSQUEST2) ? ( vr_positional_factor->value * 1.25F ) : vr_positional_factor->value; + float multiplier = factor / (cl_forwardspeed->value * ((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) ? cl_movespeedkey->value : 1.0f)); //If player is ducked then multiply by 3 otherwise positional tracking feels very wrong diff --git a/Projects/Android/jni/src/Xash3D/xash3d/engine/common/build.c b/Projects/Android/jni/src/Xash3D/xash3d/engine/common/build.c index 4acf257..9ef1036 100644 --- a/Projects/Android/jni/src/Xash3D/xash3d/engine/common/build.c +++ b/Projects/Android/jni/src/Xash3D/xash3d/engine/common/build.c @@ -139,7 +139,7 @@ Q_buildcommit will identify this build as release or "notset" */ const char *Q_buildcommit( void ) { - return "Lambda1VR-v1.4.8"; + return "Lambda1VR-v1.4.9"; } /*