@@ -1727,7 +1727,7 @@ void AHuman::UpdateWalkAngle(AHuman::Layer whichLayer) {
1727
1727
1728
1728
void AHuman::UpdateCrouching () {
1729
1729
if (!m_Controller.IsState (BODY_JUMP) && m_pHead) {
1730
- float walkPathYOffset = 0 .0F ;
1730
+ float desiredWalkPathYOffset = 0 .0F ;
1731
1731
if (m_CrouchAmountOverride == -1 .0F ) {
1732
1732
// Cast a ray above our head to either side to determine whether we need to crouch
1733
1733
float desiredCrouchHeadRoom = std::floor (m_pHead->GetRadius () + 2 .0f );
@@ -1748,13 +1748,13 @@ void AHuman::UpdateCrouching() {
1748
1748
}
1749
1749
1750
1750
float headroom = m_pHead->GetPos ().m_Y - std::max (hitPos.m_Y , hitPosPredicted.m_Y );
1751
- float adjust = desiredCrouchHeadRoom - headroom;
1752
- walkPathYOffset = std::clamp (LERP (0 .0F , 1 .0F , -m_WalkPathOffset.m_Y , adjust, 0 .3F ), 0 .0F , m_MaxWalkPathCrouchShift);
1751
+ desiredWalkPathYOffset = desiredCrouchHeadRoom - headroom;
1753
1752
} else {
1754
- walkPathYOffset = m_CrouchAmountOverride * m_MaxWalkPathCrouchShift;
1753
+ desiredWalkPathYOffset = m_CrouchAmountOverride * m_MaxWalkPathCrouchShift;
1755
1754
}
1756
1755
1757
- m_WalkPathOffset.m_Y = -walkPathYOffset;
1756
+ float finalWalkPathYOffset = std::clamp (LERP (0 .0F , 1 .0F , -m_WalkPathOffset.m_Y , desiredWalkPathYOffset, 0 .3F ), 0 .0F , m_MaxWalkPathCrouchShift);
1757
+ m_WalkPathOffset.m_Y = -finalWalkPathYOffset;
1758
1758
1759
1759
// If crouching, move at reduced speed
1760
1760
const float crouchSpeedMultiplier = 0 .5F ;
0 commit comments