Found proper aircontrol function: https://github.com/ETrun/ETrun/blob/...g_pmove.c#L841
PHP Code:
static void PM_Aircontrol(pmove_t *pm, vec3_t wishdir, float wishspeed) {
float zspeed, speed, dot, k;
int i;
float smove;
if (!pm_aircontrol) {
return;
}
// accelerate
smove = pm->cmd.rightmove;
if ((smove > 0 || smove < 0) || (wishspeed == 0.0)) {
return; // can't control movement if not moving forward or backward
}
zspeed = pm->ps->velocity[2];
pm->ps->velocity[2] = 0;
speed = VectorNormalize(pm->ps->velocity);
dot = DotProduct(pm->ps->velocity, wishdir);
k = 32.0f * pm_aircontrol * dot * dot * pml.frametime;
if (dot > 0) {
// we can't change direction while slowing down
for (i = 0; i < 2; ++i) {
pm->ps->velocity[i] = pm->ps->velocity[i] * speed + wishdir[i] * k;
}
VectorNormalize(pm->ps->velocity);
}
for (i = 0; i < 2; ++i) {
pm->ps->velocity[i] *= speed;
}
pm->ps->velocity[2] = zspeed;
}
Feels way nicer now