diff options
author | wareya <wareya@gmail.com> | 2022-01-16 17:58:04 -0500 |
---|---|---|
committer | wareya <wareya@gmail.com> | 2022-01-16 17:58:04 -0500 |
commit | 20cbf941fbe054bc24ff24feb3ef01f6b13c1842 (patch) | |
tree | affb532526dc86c2551d12cc3f2571be5be21eab | |
parent | 784b1888a9de331ba9fe6493ef004036e07468de (diff) |
re-introduce short circuiting, but only under certain circumstances
-rw-r--r-- | apps/openmw/mwphysics/movementsolver.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/openmw/mwphysics/movementsolver.cpp b/apps/openmw/mwphysics/movementsolver.cpp index 1c06c9f00f..2f2abca487 100644 --- a/apps/openmw/mwphysics/movementsolver.cpp +++ b/apps/openmw/mwphysics/movementsolver.cpp @@ -322,6 +322,18 @@ namespace MWPhysics newPosition = (newPosition + tracer.mEndPos)/2.0; } + // short circuit if we went backwards, but only if it was mostly horizontal and we're on the ground + if (seenGround && newVelocity * origVelocity <= 0.0f) + { + auto perpendicular = newVelocity ^ origVelocity; + if (perpendicular.length2() > 0.0f) + { + perpendicular.normalize(); + if (std::abs(perpendicular.z()) > 0.7071f) + break; + } + } + // Do not allow sliding up steep slopes if there is gravity. // The purpose of this is to prevent air control from letting you slide up tall, unwalkable slopes. // For that purpose, it is not necessary to do it when trying to slide along acute seams/crevices (i.e. usedSeamLogic) |