From: Florian Paul Schmidt Date: Fri, 19 Mar 2010 22:59:46 +0000 (+0100) Subject: - oops :D normalize the dodging_direction vector X-Git-Tag: xonotic-v0.1.0preview~680^2~27 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=15a1c42435176ed0124ee5f835653a41e465041e;p=xonotic%2Fxonotic-data.pk3dir.git - oops :D normalize the dodging_direction vector --- diff --git a/qcsrc/server/mutators/mutator_dodging.qc b/qcsrc/server/mutators/mutator_dodging.qc index 46ca34fd8..7134ba900 100644 --- a/qcsrc/server/mutators/mutator_dodging.qc +++ b/qcsrc/server/mutators/mutator_dodging.qc @@ -28,10 +28,19 @@ void dodging_Initialize() { } MUTATOR_HOOKFUNCTION(dodging_PlayerPhysics) { + float length; + // print("physics hook\n"); if (g_dodging == 0) return 0; + length += self.dodging_direction_x * self.dodging_direction_x; + length += self.dodging_direction_y * self.dodging_direction_y; + length = sqrt(length); + + self.dodging_direction_x *= 1/length; + self.dodging_direction_y *= 1/length; + // ramp up dodging speed by adding some velocity each frame.. if (self.dodging_action == 1) { self.velocity = self.velocity + self.dodging_direction_y * (cvar("sv_dodging_horiz_speed") * v_right) + self.dodging_direction_x * (cvar("sv_dodging_horiz_speed") * v_forward) + (cvar("sv_dodging_up_speed") * v_up);//'100 0 50';