mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-24 21:11:03 +00:00
Tune touch gesture distance; Improve use interaction in 3rd person.
This commit is contained in:
parent
260d501776
commit
d121206f83
4 changed files with 62 additions and 32 deletions
|
@ -1349,10 +1349,11 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm ) {
|
|||
|
||||
}
|
||||
|
||||
// Use triggers seems to have bigger "front" boundaries
|
||||
// (with longer range player often reaches behind them
|
||||
// not activating them at all)
|
||||
const float TOUCH_DISTANCE = 1.0f;
|
||||
// Use triggers seems to have bigger "front" boundaries allowing
|
||||
// user to trigger them from distance while it is possible to reach
|
||||
// through them when standing near. To ballance this, move hand
|
||||
// origin a bit back
|
||||
const float TOUCH_OFFSET = -10.0f;
|
||||
const vec3_t TOUCH_RANGE = { 4, 4, 4 };
|
||||
|
||||
void G_TouchTriggersWithHand( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
|
||||
|
@ -1364,7 +1365,7 @@ void G_TouchTriggersWithHand( bool offHand, gentity_t *ent, vec3_t src, vec3_t v
|
|||
|
||||
memset (touched, qfalse, sizeof(touched) );
|
||||
|
||||
VectorMA( src, TOUCH_DISTANCE, vf, dest );
|
||||
VectorMA( src, TOUCH_OFFSET, vf, dest );
|
||||
VectorSubtract( dest, TOUCH_RANGE, mins );
|
||||
VectorAdd( dest, TOUCH_RANGE, maxs );
|
||||
|
||||
|
|
|
@ -1669,12 +1669,15 @@ qboolean CanUseInfrontOf(gentity_t *ent)
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
|
||||
//FIXME: this does not match where the new accurate crosshair aims...
|
||||
//cg.refdef.vieworg, basically
|
||||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
if (thirdPersonActive) {
|
||||
VectorCopy(ent->currentOrigin, src);
|
||||
AngleVectors(ent->currentAngles, vf, NULL, NULL);
|
||||
} else {
|
||||
VectorCopy( ent->client->renderInfo.eyePoint, src );
|
||||
|
||||
AngleVectors( ent->client->ps.viewangles, vf, NULL, NULL );
|
||||
}
|
||||
|
||||
//extend to find end of use trace
|
||||
VectorMA( src, USE_DISTANCE, vf, dest );
|
||||
|
||||
|
@ -1757,7 +1760,10 @@ Try and use an entity in the world, directly ahead of us
|
|||
*/
|
||||
|
||||
#define USE_DISTANCE_BUTTON 64.0f
|
||||
#define USE_DISTANCE_GESTURE 16.0f
|
||||
#define USE_DISTANCE_GESTURE 26.0f
|
||||
// Move controller origin a bit back to prevent reach
|
||||
// through usable entities when use gesture is active
|
||||
#define USE_OFFSET -10.0f
|
||||
|
||||
void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf )
|
||||
{
|
||||
|
@ -1769,7 +1775,9 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf )
|
|||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
|
||||
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive;
|
||||
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
|
||||
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
|
||||
VectorMA( src, useOffset, vf, src );
|
||||
VectorMA( src, useDistance, vf, dest );
|
||||
|
||||
//Trace ahead to find a valid target
|
||||
|
@ -1863,10 +1871,16 @@ void TryUse( gentity_t *ent ) {
|
|||
|
||||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
vec3_t src, angles, vf;
|
||||
if (ent->client->ps.clientNum == 0 && !thirdPersonActive) {
|
||||
if (ent->client->ps.clientNum == 0) {
|
||||
if (thirdPersonActive) {
|
||||
VectorCopy(ent->currentOrigin, src);
|
||||
AngleVectors(ent->currentAngles, vf, NULL, NULL);
|
||||
TryUse_Internal(false, ent, src, vf);
|
||||
} else {
|
||||
BG_CalculateVRWeaponPosition(src, angles);
|
||||
AngleVectors( angles, vf, NULL, NULL );
|
||||
TryUse_Internal(false, ent, src, vf);
|
||||
}
|
||||
} else {
|
||||
VectorCopy(ent->client->renderInfo.eyePoint, src);
|
||||
AngleVectors(ent->client->ps.viewangles, vf, NULL, NULL);
|
||||
|
|
|
@ -819,10 +819,11 @@ void ClientImpacts( gentity_t *ent, pmove_t *pm ) {
|
|||
|
||||
}
|
||||
|
||||
// Use triggers seems to have bigger "front" boundaries
|
||||
// (with longer range player often reaches behind them
|
||||
// not activating them at all)
|
||||
const float TOUCH_DISTANCE = 1.0f;
|
||||
// Use triggers seems to have bigger "front" boundaries allowing
|
||||
// user to trigger them from distance while it is possible to reach
|
||||
// through them when standing near. To ballance this, move hand
|
||||
// origin a bit back
|
||||
const float TOUCH_OFFSET = -10.0f;
|
||||
const vec3_t TOUCH_RANGE = { 4, 4, 4 };
|
||||
|
||||
void G_TouchTriggersWithHand( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
|
||||
|
@ -834,7 +835,7 @@ void G_TouchTriggersWithHand( bool offHand, gentity_t *ent, vec3_t src, vec3_t v
|
|||
|
||||
memset (touched, qfalse, sizeof(touched) );
|
||||
|
||||
VectorMA( src, TOUCH_DISTANCE, vf, dest );
|
||||
VectorMA( src, TOUCH_OFFSET, vf, dest );
|
||||
VectorSubtract( dest, TOUCH_RANGE, mins );
|
||||
VectorAdd( dest, TOUCH_RANGE, maxs );
|
||||
|
||||
|
|
|
@ -1442,12 +1442,15 @@ qboolean CanUseInfrontOf(gentity_t *ent)
|
|||
return qfalse;
|
||||
}
|
||||
|
||||
|
||||
//FIXME: this does not match where the new accurate crosshair aims...
|
||||
//cg.refdef.vieworg, basically
|
||||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
if (thirdPersonActive) {
|
||||
VectorCopy(ent->currentOrigin, src);
|
||||
AngleVectors(ent->currentAngles, vf, NULL, NULL);
|
||||
} else {
|
||||
VectorCopy( ent->client->renderInfo.eyePoint, src );
|
||||
|
||||
AngleVectors( ent->client->ps.viewangles, vf, NULL, NULL );
|
||||
}
|
||||
|
||||
//extend to find end of use trace
|
||||
VectorMA( src, USE_DISTANCE, vf, dest );
|
||||
|
||||
|
@ -1523,7 +1526,10 @@ Try and use an entity in the world, directly ahead of us
|
|||
*/
|
||||
|
||||
#define USE_DISTANCE_BUTTON 64.0f
|
||||
#define USE_DISTANCE_GESTURE 16.0f
|
||||
#define USE_DISTANCE_GESTURE 26.0f
|
||||
// Move controller origin a bit back to prevent reach
|
||||
// through usable entities when use gesture is active
|
||||
#define USE_OFFSET -10.0f
|
||||
|
||||
void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
|
||||
gentity_t *target;
|
||||
|
@ -1534,7 +1540,9 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
|
|||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
|
||||
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive;
|
||||
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
|
||||
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
|
||||
VectorMA( src, useOffset, vf, src );
|
||||
VectorMA( src, useDistance, vf, dest );
|
||||
|
||||
//Trace ahead to find a valid target
|
||||
|
@ -1609,10 +1617,16 @@ void TryUse( gentity_t *ent ) {
|
|||
|
||||
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
|
||||
vec3_t src, angles, vf;
|
||||
if (ent->client->ps.clientNum == 0 && !thirdPersonActive) {
|
||||
if (ent->client->ps.clientNum == 0) {
|
||||
if (thirdPersonActive) {
|
||||
VectorCopy(ent->currentOrigin, src);
|
||||
AngleVectors(ent->currentAngles, vf, NULL, NULL);
|
||||
TryUse_Internal(false, ent, src, vf);
|
||||
} else {
|
||||
BG_CalculateVRWeaponPosition(src, angles);
|
||||
AngleVectors( angles, vf, NULL, NULL );
|
||||
TryUse_Internal(false, ent, src, vf);
|
||||
}
|
||||
} else {
|
||||
VectorCopy(ent->client->renderInfo.eyePoint, src);
|
||||
AngleVectors(ent->client->ps.viewangles, vf, NULL, NULL);
|
||||
|
|
Loading…
Reference in a new issue