From: terencehill Date: Sat, 13 Feb 2016 12:15:08 +0000 (+0100) Subject: cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes... X-Git-Tag: xonotic-v0.8.2~1190^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=719f59562dc7a56e1114028499a8b0bc24d06e96;p=xonotic%2Fxonotic-data.pk3dir.git cl_followmodel_velocity_absolute 0 "make the effect ignore velocity direction changes (side effect: it causes a glitch when teleporting / passing through a warpzone) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 7aa356e58..50e0ad7e7 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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" diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 3a27b19d7..debe7a5c1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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; }