Slight modifications to the force push/pull

use player's Chest as the distance calculation point and lowered the distance required to trigger.
This commit is contained in:
Simon 2022-11-27 14:51:07 +00:00
parent d71812239c
commit 6f843ab440
4 changed files with 11 additions and 4 deletions

View file

@ -1342,6 +1342,7 @@ void JKVR_Init()
vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE); vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE);
vr_weapon_velocity_trigger = Cvar_Get( "vr_weapon_velocity_trigger", "2.0", CVAR_ARCHIVE); vr_weapon_velocity_trigger = Cvar_Get( "vr_weapon_velocity_trigger", "2.0", CVAR_ARCHIVE);
vr_force_velocity_trigger = Cvar_Get( "vr_force_velocity_trigger", "2.0", CVAR_ARCHIVE); vr_force_velocity_trigger = Cvar_Get( "vr_force_velocity_trigger", "2.0", CVAR_ARCHIVE);
vr_force_distance_trigger = Cvar_Get( "vr_force_distance_trigger", "0.15", CVAR_ARCHIVE);
vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE); vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE);
vr_force_motion_controlled = Cvar_Get ("vr_force_motion_controlled", "1", CVAR_ARCHIVE); vr_force_motion_controlled = Cvar_Get ("vr_force_motion_controlled", "1", CVAR_ARCHIVE);
vr_crouch_toggle = Cvar_Get ("vr_crouch_toggle", "0", CVAR_ARCHIVE); vr_crouch_toggle = Cvar_Get ("vr_crouch_toggle", "0", CVAR_ARCHIVE);

View file

@ -10,6 +10,7 @@ extern cvar_t *vr_immersive_cinematics;
extern cvar_t *vr_screen_dist; extern cvar_t *vr_screen_dist;
extern cvar_t *vr_weapon_velocity_trigger; extern cvar_t *vr_weapon_velocity_trigger;
extern cvar_t *vr_force_velocity_trigger; extern cvar_t *vr_force_velocity_trigger;
extern cvar_t *vr_force_distance_trigger;
extern cvar_t *vr_two_handed_weapons; extern cvar_t *vr_two_handed_weapons;
extern cvar_t *vr_force_motion_controlled; extern cvar_t *vr_force_motion_controlled;
extern cvar_t *vr_crouch_toggle; extern cvar_t *vr_crouch_toggle;

View file

@ -30,6 +30,7 @@ cvar_t *vr_immersive_cinematics;
cvar_t *vr_screen_dist; cvar_t *vr_screen_dist;
cvar_t *vr_weapon_velocity_trigger; cvar_t *vr_weapon_velocity_trigger;
cvar_t *vr_force_velocity_trigger; cvar_t *vr_force_velocity_trigger;
cvar_t *vr_force_distance_trigger;
cvar_t *vr_two_handed_weapons; cvar_t *vr_two_handed_weapons;
cvar_t *vr_force_motion_controlled; cvar_t *vr_force_motion_controlled;
cvar_t *vr_crouch_toggle; cvar_t *vr_crouch_toggle;

View file

@ -821,11 +821,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
{ {
if (vr.secondaryVelocityTriggeredAttack) if (vr.secondaryVelocityTriggeredAttack)
{ {
vec3_t start, end; vec3_t start, end, chest;
VectorSubtract(vr.secondaryVelocityTriggerLocation, vr.hmdposition, start);
VectorSubtract(vr.offhandposition[0], vr.hmdposition, end); //Estimate that middle of chest is about 20cm below HMD
VectorCopy(vr.hmdposition, chest);
chest[1] -= 0.2f;
VectorSubtract(vr.secondaryVelocityTriggerLocation, chest, start);
VectorSubtract(vr.offhandposition[0], chest, end);
float deltaLength = VectorLength(end) - VectorLength(start); float deltaLength = VectorLength(end) - VectorLength(start);
if (fabs(deltaLength) > 0.2f) { if (fabs(deltaLength) > vr_force_distance_trigger->value) {
if (deltaLength < 0) { if (deltaLength < 0) {
sendButtonActionSimple(va("useGivenForce %i", FP_PULL)); sendButtonActionSimple(va("useGivenForce %i", FP_PULL));
} else { } else {