]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add fallback for if tracebox starts in solid
authorSamual Lenks <samual@xonotic.org>
Tue, 5 Feb 2013 16:48:26 +0000 (11:48 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 5 Feb 2013 16:48:26 +0000 (11:48 -0500)
qcsrc/client/View.qc

index fc98ea6d923f6e5eac33e675c1a1f8c2f1d076e4..46fa47f1a957b158999beeb32c34b639a9f87096 100644 (file)
@@ -467,8 +467,16 @@ void CSQC_UpdateView(float w, float h)
 
                        vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
                        WarpZone_TraceBox(current_view_origin, autocvar_sv_spectator_mins, autocvar_sv_spectator_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
-                       
-                       setproperty(VF_ORIGIN, ((trace_startsolid) ? current_view_origin : trace_endpos)); 
+
+                       // If the boxtrace fails, revert back to line tracing.
+                       if(trace_startsolid)
+                       {
+                               eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
+                               WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+                               setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_sv_spectator_mins_z)));
+                       }
+                       else { setproperty(VF_ORIGIN, trace_endpos); }
+
                        setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
                }
                else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code