mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-24 04:51:36 +00:00
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:
parent
d71812239c
commit
6f843ab440
4 changed files with 11 additions and 4 deletions
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue