From 3116c5296c92d47f2fed5ae1177269d2a2048420 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 29 May 2023 08:03:17 +0100 Subject: [PATCH] Proper 6DoF for Flechette alt-fire --- .../jni/OpenJK/code/game/wp_flechette.cpp | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/game/wp_flechette.cpp b/Projects/Android/jni/OpenJK/code/game/wp_flechette.cpp index 7597c14..bda59f4 100644 --- a/Projects/Android/jni/OpenJK/code/game/wp_flechette.cpp +++ b/Projects/Android/jni/OpenJK/code/game/wp_flechette.cpp @@ -55,17 +55,19 @@ static void WP_FlechetteMainFire( gentity_t *ent ) // damage *= 2; // } + vec3_t a; + if ( BG_UseVRPosition(ent)) + { + BG_CalculateVRWeaponPosition(muzzle, a); + } + else { + vectoangles(forwardVec, a); + } + for ( int i = 0; i < FLECHETTE_SHOTS; i++ ) { vec3_t angs; - if ( BG_UseVRPosition(ent)) - { - BG_CalculateVRWeaponPosition(muzzle, angs); - } - else { - vectoangles(forwardVec, angs); - } - + VectorCopy(a, angs); if ( i == 0 && ent->s.number == 0 ) { // do nothing on the first shot for the player, this one will hit the crosshairs @@ -263,8 +265,14 @@ static void WP_FlechetteAltFire( gentity_t *self ) { vec3_t dir, fwd, start, angs; - vectoangles( forwardVec, angs ); - VectorCopy( muzzle, start ); + if ( BG_UseVRPosition(self)) + { + BG_CalculateVRWeaponPosition(start, angs); + } + else { + vectoangles( forwardVec, angs ); + VectorCopy( muzzle, start ); + } WP_TraceSetStart( self, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall