Added Trigger Release Band Cvars + Fixed Vive Controls

Added Cvars for engaging Grip by level. Defaults Below:
vr_engage_trigger 0.7
vr_release_trigger 0.7
vr_engage_trigger_index 0.7 (Index Only)
vr_release_trigger_index 0.05 (Index Only)

Vive Controls
Left Trackpad press (whilst roughly in the middle) - Crouch
Left menu Button - Pause
Trackpad Right Press - DataPad

Right Menu Button - 1st / 3rd person
Right Trackpad Press Up = Alt Fire / Switch Off Saber
Right Trackpad Press Down = Jump
Right Trackpad Press Center = Use / Interact
This commit is contained in:
Grant Bagwell 2024-01-13 20:12:27 +01:00
parent c7f4874aba
commit e123731955
4 changed files with 87 additions and 21 deletions

View file

@ -802,15 +802,24 @@ void TBXR_UpdateControllers( )
trackpadPosition = GetActionStateVector2(trackPadAction, SIDE_LEFT).currentState;
if (GetActionStateBoolean(trackPadClickAction, SIDE_LEFT).currentState)
{
if (trackpadPosition.x >= -0.2 && trackpadPosition.x <= 0.2)
if (trackpadPosition.x >= -0.3 && trackpadPosition.x <= 0.3)
{
if (trackpadPosition.y >= 0.2)
//Always the in center for crouch
//Crouch
leftTrackedRemoteState_new.Buttons |= xrButton_LThumb;
leftTrackedRemoteState_new.Buttons |= xrButton_Joystick;
}
else
{
if (trackpadPosition.x <= -0.3) //Left
{
leftTrackedRemoteState_new.Buttons |= xrButton_Y;
//Ingame Menu - dont need this on Vive
//leftTrackedRemoteState_new.Buttons |= xrButton_X;
}
else if (trackpadPosition.y <= -0.2)
else if(trackpadPosition.x >= 0.3) //Right
{
leftTrackedRemoteState_new.Buttons |= xrButton_X;
//DataPad
leftTrackedRemoteState_new.Buttons |= xrButton_Y;
}
}
}
@ -821,31 +830,48 @@ void TBXR_UpdateControllers( )
if (GetActionStateBoolean(XTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_X;
if (GetActionStateBoolean(YAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Buttons |= xrButton_Y;
if (GetActionStateBoolean(YTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_Y;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Buttons |= xrButton_LThumb;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Buttons |= xrButton_Joystick;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_LThumb;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_Joystick;
}
//Defaults engage/disable at the same level
float enableLevel = vr_engage_trigger->value;
float disableLevel = vr_release_trigger->value;
//INDEX we'll need to add force check so its not boolean
if (gAppState.controllersPresent == VIVE_CONTROLLERS)
{
leftTrackedRemoteState_new.GripTrigger = GetActionStateBoolean(squeezeClickAction, SIDE_LEFT).currentState;
enableLevel = 1.0f;
disableLevel = 1.0f;
}
else if (gAppState.controllersPresent == INDEX_CONTROLLERS)
{
leftTrackedRemoteState_new.GripTrigger = GetActionStateFloat(squeezeForceAction, SIDE_LEFT).currentState;
// Use different release level for the Index Knuckles
enableLevel = vr_engage_trigger_index->value;
disableLevel = vr_release_trigger_index->value;
}
else
{
leftTrackedRemoteState_new.GripTrigger = GetActionStateFloat(squeezeAction, SIDE_LEFT).currentState;
}
if (leftTrackedRemoteState_new.GripTrigger > 0.7f)
static int leftGripEngaged = false;
if (leftTrackedRemoteState_new.GripTrigger >= enableLevel && !leftGripEngaged)
{
leftGripEngaged = true;
}
else if (leftTrackedRemoteState_new.GripTrigger < disableLevel && leftGripEngaged)
{
leftGripEngaged = false;
}
if (leftGripEngaged)
{
leftTrackedRemoteState_new.Buttons |= xrButton_GripTrigger;
}
if (GetActionStateBoolean(thumbstickClickAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Buttons |= xrButton_LThumb;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Buttons |= xrButton_Joystick;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_LThumb;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_Joystick;
leftTrackedRemoteState_new.IndexTrigger = GetActionStateFloat(triggerAction, SIDE_LEFT).currentState;
if (leftTrackedRemoteState_new.IndexTrigger > 0.5f) leftTrackedRemoteState_new.Buttons |= xrButton_Trigger;
if (GetActionStateBoolean(triggerTouchAction, SIDE_LEFT).currentState) leftTrackedRemoteState_new.Touches |= xrButton_Trigger;
@ -867,15 +893,25 @@ void TBXR_UpdateControllers( )
{
if (trackpadPosition.x >= -0.2 && trackpadPosition.x <= 0.2)
{
if (trackpadPosition.y >= 0.2)
if (trackpadPosition.y >= 0.3)
{
//Menu button on Vive instead
rightTrackedRemoteState_new.Buttons |= xrButton_B;
}
else if (trackpadPosition.y <= -0.2)
else if (trackpadPosition.y <= -0.3)
{
rightTrackedRemoteState_new.Buttons |= xrButton_A;
}
else
{
rightTrackedRemoteState_new.Buttons |= xrButton_Joystick;
rightTrackedRemoteState_new.Buttons |= xrButton_RThumb;
}
}
else
{
rightTrackedRemoteState_new.Buttons |= xrButton_Joystick;
rightTrackedRemoteState_new.Buttons |= xrButton_RThumb;
}
}
if (GetActionStateBoolean(backAction, SIDE_RIGHT).currentState)
@ -890,9 +926,16 @@ void TBXR_UpdateControllers( )
if (GetActionStateBoolean(BAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_B;
if (GetActionStateBoolean(BTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_B;
if (GetActionStateBoolean(backAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_Enter;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_RThumb;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_Joystick;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_RThumb;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_Joystick;
}
//INDEX we'll need to add force check so its not boolean
//Defaults engage/disable at the same level
if (gAppState.controllersPresent == VIVE_CONTROLLERS)
{
rightTrackedRemoteState_new.GripTrigger = GetActionStateBoolean(squeezeClickAction, SIDE_RIGHT).currentState;
@ -905,12 +948,23 @@ void TBXR_UpdateControllers( )
{
rightTrackedRemoteState_new.GripTrigger = GetActionStateFloat(squeezeAction, SIDE_RIGHT).currentState;
}
if (rightTrackedRemoteState_new.GripTrigger > 0.7f) rightTrackedRemoteState_new.Buttons |= xrButton_GripTrigger;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_RThumb;
if (GetActionStateBoolean(thumbstickClickAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Buttons |= xrButton_Joystick;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_RThumb;
if (GetActionStateBoolean(thumbstickTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_Joystick;
static int rightGripEngaged = false;
if (rightTrackedRemoteState_new.GripTrigger >= enableLevel && !rightGripEngaged)
{
rightGripEngaged = true;
}
else if (rightTrackedRemoteState_new.GripTrigger < disableLevel && rightGripEngaged)
{
rightGripEngaged = false;
}
if (rightGripEngaged)
{
rightTrackedRemoteState_new.Buttons |= xrButton_GripTrigger;
}
rightTrackedRemoteState_new.IndexTrigger = GetActionStateFloat(triggerAction, SIDE_RIGHT).currentState;
if (rightTrackedRemoteState_new.IndexTrigger > 0.5f) rightTrackedRemoteState_new.Buttons |= xrButton_Trigger;
if (GetActionStateBoolean(triggerTouchAction, SIDE_RIGHT).currentState) rightTrackedRemoteState_new.Touches |= xrButton_Trigger;

View file

@ -35,3 +35,7 @@ extern cvar_t *vr_use_gesture_boundary;
extern cvar_t *vr_align_weapons; // Only used for development
extern cvar_t *vr_refresh;
extern cvar_t *vr_super_sampling;
extern cvar_t *vr_engage_trigger;
extern cvar_t *vr_release_trigger;
extern cvar_t *vr_engage_trigger_index;
extern cvar_t *vr_release_trigger_index;

View file

@ -48,6 +48,10 @@ cvar_t *vr_use_gesture_boundary;
cvar_t *vr_align_weapons;
cvar_t *vr_refresh;
cvar_t *vr_super_sampling;
cvar_t *vr_engage_trigger;
cvar_t *vr_release_trigger;
cvar_t *vr_engage_trigger_index;
cvar_t *vr_release_trigger_index;
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
ovrInputStateTrackedRemote leftTrackedRemoteState_new;

View file

@ -281,6 +281,10 @@ void VR_Init()
vr_use_gesture_boundary = Cvar_Get ("vr_use_gesture_boundary", "0.35", CVAR_ARCHIVE);
vr_align_weapons = Cvar_Get ("vr_align_weapons", "0", CVAR_ARCHIVE);
vr_refresh = Cvar_Get ("vr_refresh", "72", CVAR_ARCHIVE);
vr_engage_trigger = Cvar_Get("vr_engage_trigger", "0.7", CVAR_ARCHIVE);
vr_release_trigger = Cvar_Get("vr_release_trigger", "0.7", CVAR_ARCHIVE);
vr_engage_trigger_index = Cvar_Get("vr_engage_trigger_index", "0.7", CVAR_ARCHIVE);
vr_release_trigger_index = Cvar_Get("vr_release_trigger_index", "0.05", CVAR_ARCHIVE);
cvar_t *expanded_menu_enabled = Cvar_Get ("expanded_menu_enabled", "0", CVAR_ARCHIVE);
if (FS_FileExists("expanded_menu.pk3") || FS_BaseFileExists("expanded_menu.pk3")) {