]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a new function vec2(v) returning only the xy components
authorRudolf Polzer <divverent@alientrap.org>
Sat, 14 Aug 2010 19:52:43 +0000 (21:52 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 14 Aug 2010 19:52:43 +0000 (21:52 +0200)
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/cl_physics.qc

index 72af701119045b374be237246f0d9289dd32989d..f33512f2355f8823669f1140b691dfe779be7282 100644 (file)
@@ -1913,3 +1913,9 @@ float get_model_parameters(string m, float sk)
 
        return 1;
 }
+
+vector vec2(vector v)
+{
+       v_z = 0;
+       return v;
+}
index f2c2e6702ab99389b17a24227f57258860232215..767092cc7532c689710cc82421abd15497d5d146 100644 (file)
@@ -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);
index 1f2ff183e1f04412bfcd73abfaca4a94a4245902..cb94429d97b071df8ad2a5bc0ec13567dab8478c 100644 (file)
@@ -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;