]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes... 279/head
authorterencehill <piuntn@gmail.com>
Sat, 13 Feb 2016 12:15:08 +0000 (13:15 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 13 Feb 2016 16:51:03 +0000 (17:51 +0100)
defaultXonotic.cfg
qcsrc/client/view.qc

index 7aa356e589785eed8699c935fecbca509081c9bb..50e0ad7e724bcf15dc9466f4940d0e08563a1a9a 100644 (file)
@@ -167,6 +167,7 @@ cl_bobmodel_up 0.1 // amount the gun sways up and down
 cl_followmodel 1 // enables weapon pushing / pulling effect when walking
 seta cl_followmodel_speed 0.3 "gun following speed"
 seta cl_followmodel_limit 1000 "gun following limit"
+seta cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone)"
 seta cl_followmodel_velocity_lowpass 0.05 "gun following velocity lowpass averaging time"
 seta cl_followmodel_highpass 0.05 "gun following highpass averaging time"
 seta cl_followmodel_lowpass 0.03 "gun following lowpass averaging time"
index 3a27b19d79befefbe859bb3735735439d8a12414..debe7a5c1864bc312920bb8b2d8fb7619e955939 100644 (file)
@@ -128,6 +128,7 @@ float autocvar_cl_leanmodel_lowpass = 0.05;
        lowpass_limited(value.z, frac, limit, ref_store.z, ref_out.z); \
 } MACRO_END
 
+bool autocvar_cl_followmodel_velocity_absolute;
 void viewmodel_animate(entity this)
 {
        static float prevtime;
@@ -165,11 +166,17 @@ void viewmodel_animate(entity this)
                static vector gunorg_adjustment_lowpass;
 
                vector vel;
-               vector forward, right = '0 0 0', up = '0 0 0';
-               MAKEVECTORS(makevectors, view_angles, forward, right, up);
-               vel.x = view.velocity * forward;
-               vel.y = view.velocity * right * -1;
-               vel.z = view.velocity * up;
+               if(autocvar_cl_followmodel_velocity_absolute)
+                       vel = view.velocity;
+               else
+               {
+                       vector forward, right = '0 0 0', up = '0 0 0';
+                       MAKEVECTORS(makevectors, view_angles, forward, right, up);
+                       vel.x = view.velocity * forward;
+                       vel.y = view.velocity * right * -1;
+                       vel.z = view.velocity * up;
+               }
+
                frac = avg_factor(autocvar_cl_followmodel_velocity_lowpass);
                lowpass3_limited(vel, frac, autocvar_cl_followmodel_limit, vel_average, gunorg);
 
@@ -182,6 +189,17 @@ void viewmodel_animate(entity this)
                frac = avg_factor(autocvar_cl_followmodel_lowpass);
                lowpass3(gunorg, frac, gunorg_adjustment_lowpass, gunorg);
 
+               if(autocvar_cl_followmodel_velocity_absolute)
+               {
+                       vector fixed_gunorg;
+                       vector forward, right = '0 0 0', up = '0 0 0';
+                       MAKEVECTORS(makevectors, view_angles, forward, right, up);
+                       fixed_gunorg.x = gunorg * forward;
+                       fixed_gunorg.y = gunorg * right * -1;
+                       fixed_gunorg.z = gunorg * up;
+                       gunorg = fixed_gunorg;
+               }
+
                this.origin += gunorg;
        }