Ensure menu cursor is correctly aligned

store the yaw at which the menu is invoked to calculate correct X
slightly increased the cursor movement scale as it was a little too much wrist turning required to reach outer edges of screen
This commit is contained in:
Simon 2022-03-23 20:48:01 +00:00
parent 14cf79c585
commit 56d1334007
4 changed files with 11 additions and 9 deletions

View file

@ -57,6 +57,7 @@ typedef struct {
vec2_t thumbstick_location[2]; //left / right thumbstick locations - used in cgame
float menuYaw;
int *menuCursorX;
int *menuCursorY;
qboolean menuLeftHanded;

View file

@ -477,8 +477,8 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
yaw = (vr_righthanded->integer != 0) ? vr.weaponangles[YAW] : vr.offhandangles[YAW];
pitch = (vr_righthanded->integer != 0) ? vr.weaponangles[PITCH] : vr.offhandangles[PITCH];
}
int x = 320 - tan(yaw * (M_PI*2 / 360)) * 300;
int y = 240 + tan((pitch + vr_weaponPitch->value) * (M_PI*2 / 360)) * 300;
int x = 320 - tan((yaw - vr.menuYaw) * (M_PI*2 / 360)) * 400;
int y = 240 + tan((pitch + vr_weaponPitch->value) * (M_PI*2 / 360)) * 400;
*vr.menuCursorX = x;
*vr.menuCursorY = y;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, 0, 0, 0, NULL);

View file

@ -286,8 +286,6 @@ void VR_DrawFrame( engine_t* engine ) {
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
fov_x / vr.weapon_zoomLevel, fov_y / vr.weapon_zoomLevel, 0.0f, 0.0f, 1.0f, 0.0f );
static float playerYaw = 0;
int eyeW, eyeH;
VR_GetResolution(engine, &eyeW, &eyeH);
@ -299,7 +297,7 @@ void VR_DrawFrame( engine_t* engine ) {
// Add a simple cylindrical layer
cylinderLayer.Cylinder =
BuildCylinderLayer(engine, eyeW, eyeW * 0.75f, &engine->tracking, radians(playerYaw) );
BuildCylinderLayer(engine, eyeW, eyeW * 0.75f, &engine->tracking, radians(vr.menuYaw) );
const ovrLayerHeader2* layers[] = {
&cylinderLayer.Header
@ -332,7 +330,7 @@ void VR_DrawFrame( engine_t* engine ) {
}
else
{
playerYaw = vr.hmdorientation[YAW];
vr.menuYaw = vr.hmdorientation[YAW];
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
layer.HeadPose = engine->tracking.HeadPose;

View file

@ -3,9 +3,12 @@
setlocal
set BUILD_TYPE=release
set KEYSTORE=
set KEYSTORE_PASS=
set VERSION=0.21.1
set VERSION=0.27.1
@REM Define the following environment variables to sign a release build
@REM set KEYSTORE=
@REM set KEYSTORE_PASS=
set ANDROID_SDK_ROOT=%AppData%\..\Local\Android\Sdk
set adb="%ANDROID_SDK_ROOT%\platform-tools\adb.exe"