Fixed slow sideways movement whilst fly-sprinting

This commit is contained in:
Uzixt 2026-03-01 23:31:49 +00:00
parent 5b5b9f6072
commit 26fd431af4

View file

@ -462,9 +462,14 @@ void LocalPlayer::aiStep()
if( isSprinting() )
{
// Accelrate up to full speed if we are sprinting, moving in the direction of the view vector
flyX = (float)viewVector->x * input->ya;
float yawRad = yRot * (PI / 180.0f);
flyX = -sinf(yawRad) * input->ya + cosf(yawRad) * input->xa;
flyY = (float)viewVector->y * input->ya;
flyZ = (float)viewVector->z * input->ya;
flyZ = cosf(yawRad) * input->ya + sinf(yawRad) * input->xa;
float h = sqrtf(flyX * flyX + flyZ * flyZ);
if (h > 1.0f) { flyX /= h; flyZ /= h; }
float scale = ((float)(SPRINT_DURATION - sprintTime))/10.0f;
scale = scale * scale;