Skip to content

Commit

Permalink
Update pm_shared.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintWish committed Sep 2, 2024
1 parent aba080f commit de11fec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/game/shared/movement/pm_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,16 @@ int PM_ClipVelocity(Vector &in, Vector &normal, Vector &out, float overbounce)
out[i] = 0;
}

// iterate once to make sure we aren't still moving through the plane
float adjust = DotProduct(out, normal);
if (adjust <= 0.0f)
{
// min this against a small number (but no further from zero than -DIST_EPSILON) to account for crossing a plane with a near-parallel normal
adjust = min(adjust, -DIST_EPSILON);
for (i=0 ; i<3 ; i++)
out[i] -= normal[i]*adjust;
}

// Return blocking flags.
return blocked;
}
Expand Down

0 comments on commit de11fec

Please sign in to comment.