diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs index 98fed6c..95999ae 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs @@ -422,9 +422,23 @@ namespace Code.Gameplay.Character.Controller public void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport) { - if (_wallRunningMechanic.TryStartWallRun(hitNormal, hitPoint)) - { - } + if (_wallRunningMechanic.TryStartWallRun(hitNormal, hitPoint)) return; + + var horizontalVelocity = Vector3.ProjectOnPlane(motor.Velocity, motor.CharacterUp).normalized; + var velocitySqrMag = horizontalVelocity.sqrMagnitude; + + if (!(velocitySqrMag > 0.01f)) return; + + var dot = Vector3.Dot(horizontalVelocity, hitNormal); + + const float impactThreshold = -0.3f; + + if (!(dot < impactThreshold)) return; + if (_dashMechanic.IsDashing) + _dashMechanic.EndDash(); + + if (_slideMechanic.IsSliding) + _slideMechanic.EndSlide(); } public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint,