mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-24 21:11:03 +00:00
Improved weapon offhand grab logic
This commit is contained in:
parent
0c6d44f655
commit
e6542f1d0f
1 changed files with 25 additions and 4 deletions
|
@ -295,13 +295,34 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
if (offhandGripPushed)
|
if (offhandGripPushed)
|
||||||
{
|
{
|
||||||
if (!vr.weapon_stabilised && vr.item_selector == 0 &&
|
if (!vr.weapon_stabilised && vr.item_selector == 0 &&
|
||||||
!vr.misc_camera && !vr.cgzoommode)
|
!vr.misc_camera && !vr.cgzoommode && vr_two_handed_weapons->integer)
|
||||||
{
|
{
|
||||||
if (distance < STABILISATION_DISTANCE &&
|
if (distance < STABILISATION_DISTANCE &&
|
||||||
vr_two_handed_weapons->integer &&
|
cl.frame.ps.weapon == WP_SABER) {
|
||||||
cl.frame.ps.weapon >= WP_SABER) {
|
|
||||||
vr.weapon_stabilised = true;
|
vr.weapon_stabilised = true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
vec3_t dir, weaponposition, offhandposition;
|
||||||
|
VectorSet(weaponposition, pWeapon->Pose.position.z, pWeapon->Pose.position.x, pWeapon->Pose.position.y);
|
||||||
|
VectorSet(offhandposition, pOff->Pose.position.z, pOff->Pose.position.x, pOff->Pose.position.y);
|
||||||
|
VectorSubtract(weaponposition, offhandposition, dir);
|
||||||
|
VectorNormalize(dir);
|
||||||
|
|
||||||
|
vec3_t weaponangles, weaponForward, rotation = { 0 };
|
||||||
|
rotation[PITCH] = vr_weapon_pitchadjust->value;
|
||||||
|
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, weaponangles);
|
||||||
|
AngleVectors(weaponangles, weaponForward, NULL, NULL);
|
||||||
|
VectorNormalize(weaponForward);
|
||||||
|
|
||||||
|
if (cl.frame.ps.weapon > WP_SABER &&
|
||||||
|
DotProduct(weaponForward, dir) > 0.8f)
|
||||||
|
{
|
||||||
|
vr.weapon_stabilised = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vr.weapon_stabilised)
|
||||||
|
{
|
||||||
vr.item_selector = 2;
|
vr.item_selector = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue