]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
sv_doublejump: clip velocity when landing (fixes sticking-to-floor bug)
authorRudolf Polzer <divverent@xonotic.org>
Sun, 11 Sep 2011 12:47:17 +0000 (14:47 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 11 Sep 2011 12:47:17 +0000 (14:47 +0200)
qcsrc/server/cl_physics.qc

index b10c88d49d305fb17e2c0bbd788e6402443cc1b8..7d14fbdae9868261727ba21db69d3ceb278794d6 100644 (file)
@@ -34,7 +34,15 @@ void PlayerJump (void)
        {
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
                if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
+               {
                        doublejump = TRUE;
+
+                       // we MUST clip velocity here!
+                       float f;
+                       f = self.velocity * trace_plane_normal;
+                       if(f < 0)
+                               self.velocity -= f * trace_plane_normal;
+               }
        }
 
        mjumpheight = autocvar_sv_jumpvelocity;