From: Rudolf Polzer Date: Sat, 14 Aug 2010 19:52:43 +0000 (+0200) Subject: add a new function vec2(v) returning only the xy components X-Git-Tag: xonotic-v0.1.0preview~361^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a6c13a4f9db7b316d577d93acd586b8c85b386f9;p=xonotic%2Fxonotic-data.pk3dir.git add a new function vec2(v) returning only the xy components --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 72af70111..f33512f23 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1913,3 +1913,9 @@ float get_model_parameters(string m, float sk) return 1; } + +vector vec2(vector v) +{ + v_z = 0; + return v; +} diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index f2c2e6702..767092cc7 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -236,3 +236,5 @@ switch(id) { \ case HUD_PANEL_CHAT: panel_name = HUD_PANELNAME_CHAT; break; \ }\ HUD_Panel_GetName_Part2(id) + +vector vec2(vector v); diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 1f2ff183e..cb94429d9 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -359,8 +359,7 @@ void RaceCarPhysics() float mt; rigvel_z -= frametime * sv_gravity; // 4x gravity plays better - rigvel_xy = rigvel; - rigvel_xy_z = 0; + rigvel_xy = vec2(rigvel); if(g_bugrigs_planar_movement_car_jumping && !g_touchexplode) // touchexplode is a better way to handle collisions mt = MOVE_NORMAL; @@ -552,7 +551,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce vel_straight = self.velocity * wishdir; vel_z = self.velocity_z; - vel_xy = self.velocity - vel_z * '0 0 1'; + vel_xy = vec2(self.velocity); vel_perpend = vel_xy - vel_straight * wishdir; step = accel * frametime * wishspeed0;