Fixed couple of bugs..

This commit is contained in:
Simon 2020-08-31 18:56:22 +01:00
parent 62eef448fc
commit a3077f2711
2 changed files with 16 additions and 21 deletions

View file

@ -126,15 +126,13 @@ void CalculateShoulderPosition()
{
VectorCopy(vr.hmdposition, vr.vstock_shoulder);
//Adjust to shoulder location for when vstock was engaged
vr.vstock_shoulder[1] -= 0.25f;
vr.vstock_shoulder[1] -= 0.12f;
//This bit might be overkill
/*
//offset to the appropriate shoulder a little bit
vec2_t xy;
rotateAboutOrigin(0.25f, 0.0f, - vr.hmdorientation[YAW], xy);
rotateAboutOrigin(0.07f, 0.0f, -vr.hmdorientation[YAW], xy);
vr.vstock_shoulder[0] += xy[0];
vr.vstock_shoulder[1] += xy[1];
*/
vr.vstock_shoulder[2] += xy[1];
}
//YAW: Left increase, Right decrease

View file

@ -170,14 +170,15 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
if (vr.pistol)
{
//For pistols, it is simply a case of holding the two controllers close together
if (distance < (STABILISATION_DISTANCE / 2.0f))
if (distance < (STABILISATION_DISTANCE / 3.0f))
{
stabilised = qtrue;
if (vr.weapon_stabilised != stabilised) {
// blip to let user know they are stabilised
RTCWVR_Vibrate(100, 0, 0.4);
RTCWVR_Vibrate(100, 1, 0.4);
}
}
if (vr.weapon_stabilised != stabilised) {
// blip to let user know they are stabilised
RTCWVR_Vibrate(100, 0, 0.4);
RTCWVR_Vibrate(100, 1, 0.4);
}
}
else if ((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) && (distance < STABILISATION_DISTANCE))
@ -185,13 +186,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
stabilised = qtrue;
}
//Recalculate shoulder position if required
if (vr.weapon_stabilised != stabilised &&
vr_virtual_stock->integer == 1 &&
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger))
{
CalculateShoulderPosition();
}
CalculateShoulderPosition();
vr.weapon_stabilised = stabilised;
@ -269,6 +264,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Now lerp with previous position to smooth it out
VectorLerp(vr.weaponoffset_history[0], 0.5f, vr.current_weaponoffset, vr.calculated_weaponoffset);
}
else
{
VectorCopy(vr.current_weaponoffset, vr.calculated_weaponoffset);
}
//Does weapon velocity trigger attack (knife) and is it fast enough
static qboolean velocityTriggeredAttack = false;
@ -693,7 +692,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
RTCWVR_ResyncClientYawWithGameYaw();
CalculateShoulderPosition();
}
} else if (pPrimaryJoystick->x < 0.3f) {
increaseSnap = true;
@ -716,7 +714,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
RTCWVR_ResyncClientYawWithGameYaw();
CalculateShoulderPosition();
}
} else if (pPrimaryJoystick->x > -0.3f) {
decreaseSnap = true;