]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make cl_followmodel effect more realistic by taking into account pitch
authorterencehill <piuntn@gmail.com>
Wed, 13 Jan 2016 20:38:41 +0000 (21:38 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 13 Jan 2016 20:38:41 +0000 (21:38 +0100)
qcsrc/client/view.qc

index f74fbfdab7e1509397411831444c1794ce236e87..b792d386fd5387c419e336f8aa35606968981f7a 100644 (file)
@@ -176,8 +176,12 @@ void viewmodel_animate(entity this)
                frac = avg_factor(autocvar_cl_followmodel_lowpass);
                lowpass3(gunorg, frac, gunorg_adjustment_lowpass, gunorg);
 
-               vector v = rotate(gunorg, YAW(view_angles) * DEG2RAD); // rotate world coordinates to relative ones
-               v.z = gunorg.z;
+               vector v;
+               vector forward, right = '0 0 0', up = '0 0 0';
+               MAKEVECTORS(makevectors, view_angles, forward, right, up);
+               v.x = gunorg * forward;
+               v.y = gunorg * right * -1;
+               v.z = gunorg * up;
                this.origin += v;
        }