From de11fec172b91aeaf2228052bc8e3596bcd5595f Mon Sep 17 00:00:00 2001 From: Saint Wish <6036821+SaintWish@users.noreply.github.com> Date: Mon, 2 Sep 2024 03:22:20 -0500 Subject: [PATCH] Update pm_shared.cpp From https://github.com/ValveSoftware/halflife/pull/3668 --- src/game/shared/movement/pm_shared.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game/shared/movement/pm_shared.cpp b/src/game/shared/movement/pm_shared.cpp index a6e1c29f..851baa17 100644 --- a/src/game/shared/movement/pm_shared.cpp +++ b/src/game/shared/movement/pm_shared.cpp @@ -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; }