]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a rough frontal view mode to the chase camera
authorMario <mario.mario@y7mail.com>
Wed, 11 Nov 2020 23:24:42 +0000 (09:24 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 11 Nov 2020 23:24:42 +0000 (09:24 +1000)
qcsrc/lib/csqcmodel/cl_player.qc
xonotic-client.cfg

index 303fc38f29e6d97b3f482c2b2281a4ee44715ca3..acd503c5a222672078d0dd5d23f6c48126081c6c 100644 (file)
@@ -434,6 +434,7 @@ float autocvar_chase_back;
 float autocvar_chase_up;
 bool autocvar_chase_overhead;
 float autocvar_chase_pitchangle;
+bool autocvar_chase_front;
 vector CSQCPlayer_ApplyChase(entity this, vector v)
 {
        vector forward;
@@ -479,6 +480,8 @@ vector CSQCPlayer_ApplyChase(entity this, vector v)
        {
                makevectors(view_angles);
                forward = v_forward;
+               if(autocvar_chase_front)
+                       forward = normalize(forward * -1);
                // trace a little further so it hits a surface more consistently (to avoid 'snapping' on the edge of the range)
                float cdist = -autocvar_chase_back - 8;
                chase_dest.x = v.x + forward.x * cdist;
@@ -488,6 +491,14 @@ vector CSQCPlayer_ApplyChase(entity this, vector v)
                v.x = 1 * trace_endpos.x + 8 * forward.x + 4 * trace_plane_normal.x;
                v.y = 1 * trace_endpos.y + 8 * forward.y + 4 * trace_plane_normal.y;
                v.z = 1 * trace_endpos.z + 8 * forward.z + 4 * trace_plane_normal.z;
+
+               if(autocvar_chase_front)
+               {
+                       // now flip the view so the player is looking at themselves
+                       vector newang = vectoangles(forward);
+                       view_angles.x = view_angles.x * -1; // inverse up-down looking direction
+                       view_angles.y = newang.y;
+               }
        }
 
 #if 0
index bf1735e0240655e9cdf937e7208222c2e5a290cc..8f7066d96b417c00176945c3b02319f44d7e7240 100644 (file)
@@ -216,6 +216,8 @@ seta cl_eventchase_vehicle 1 "camera goes into 3rd person mode when inside a veh
 seta cl_eventchase_vehicle_viewoffset "0 0 80"
 seta cl_eventchase_vehicle_distance 250
 
+seta chase_front 0 "show frontal view when using chase cam"
+
 set _vehicles_shownchasemessage 0
 
 seta cl_particles_oldvortexbeam 0 "Uses the old v2.3 Vortex beam instead of the new beam, only works if server allows it (g_allow_oldvortexbeam 1)"