maxvelocity correctly enforced

This commit is contained in:
BjossiAlfreds 2019-09-19 23:17:42 +00:00
parent bd6fc9df5f
commit 8cb29103e2

View file

@ -76,24 +76,15 @@ SV_TestEntityPosition(edict_t *ent)
void
SV_CheckVelocity(edict_t *ent)
{
int i;
if (!ent)
{
return;
}
/* bound velocity */
for (i = 0; i < 3; i++)
if (VectorLength(ent->velocity) > sv_maxvelocity->value)
{
if (ent->velocity[i] > sv_maxvelocity->value)
{
ent->velocity[i] = sv_maxvelocity->value;
}
else if (ent->velocity[i] < -sv_maxvelocity->value)
{
ent->velocity[i] = -sv_maxvelocity->value;
}
VectorNormalize(ent->velocity);
VectorScale(ent->velocity, sv_maxvelocity->value, ent->velocity);
}
}