Proper support for left-hand controls

also made the RR pistol a little less terrible, as it is a bit frustrating in VR
This commit is contained in:
Simon 2023-02-19 09:57:48 +00:00
parent 74c7a65842
commit 379157708c
4 changed files with 24 additions and 6 deletions

View file

@ -344,9 +344,20 @@ VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const
get_weapon_pos_and_angle(x, y, z, pitch, yaw); get_weapon_pos_and_angle(x, y, z, pitch, yaw);
new_projection.translate(-x * weapon_stereo_effect, (z-hmdPosition[1]) * weapon_stereo_effect, -y * weapon_stereo_effect); new_projection.translate(-x * weapon_stereo_effect, (z-hmdPosition[1]) * weapon_stereo_effect, -y * weapon_stereo_effect);
new_projection.rotate(weaponangles[YAW] - hmdorientation[YAW], 0, 1, 0); if (vr_control_scheme < 10)
new_projection.rotate(weaponangles[PITCH], 1, 0, 0); {
new_projection.rotate(weaponangles[ROLL], 0, 0, 1); // Right-handed
new_projection.rotate(weaponangles[YAW] - hmdorientation[YAW], 0, 1, 0);
new_projection.rotate(weaponangles[PITCH], 1, 0, 0);
new_projection.rotate(weaponangles[ROLL], 0, 0, 1);
}
else
{
// Left-handed
new_projection.rotate(180.0f + weaponangles[YAW] - hmdorientation[YAW], 0, 1, 0);
new_projection.rotate(-weaponangles[PITCH], 1, 0, 0);
new_projection.rotate(-weaponangles[ROLL], 0, 0, 1);
}
float weapon_scale = 0.6f; float weapon_scale = 0.6f;
new_projection.scale(-weapon_scale, weapon_scale, -weapon_scale); new_projection.scale(-weapon_scale, weapon_scale, -weapon_scale);

View file

@ -67,7 +67,7 @@
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
CUSTOM_CVAR(Int, showendoom, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{ {
if (self < 0) self = 0; if (self < 0) self = 0;
else if (self > 2) self=2; else if (self > 2) self=2;

View file

@ -231,9 +231,16 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
{ {
if (aimed == nullptr) if (aimed == nullptr)
{ {
//I've adjusted the pistol to be a little less frustratingly random in VR
#ifdef _NOTVR
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4); ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.); setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
zvel += 0.5 - krandf(1); zvel += 0.5 - krandf(1);
#else
ang += DAngle22_5 / 32 - randomAngle(22.5 / 16);
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
zvel += 0.125 - krandf(0.25);
#endif
} }
} }
else else

View file

@ -540,8 +540,8 @@ OptionValue "DirectionMode"
OptionValue "ControlScheme" OptionValue "ControlScheme"
{ {
10, "Right Handed" 0, "Right Handed"
0, "Left Handed" 10, "Left Handed"
} }
OptionMenu "VROptionsMenu" protected OptionMenu "VROptionsMenu" protected