diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs index 64967d5..627fdd6 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallClimbMechanic.cs @@ -53,7 +53,9 @@ namespace Code.Gameplay.Character.Controller.Abilities // Проекция скорости на направление к стене (отрицательная, если летим в стену) var velocityIntoWall = Vector3.Dot(currentVelocity, -hitNormal); - + + Debug.Log($"[TryClimbWall] velIntoWall={velocityIntoWall:F2}, min={_minWallClimbSpeed}, climbed={_hasClimbedThisWallSession}, cooldown={_wallClimbCooldownTimer:F2}"); + // Если движемся в стену с достаточной скоростью if (velocityIntoWall > _minWallClimbSpeed) { diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs index ae39cf7..e41c3d8 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallLeanMechanic.cs @@ -95,8 +95,7 @@ namespace Code.Gameplay.Character.Controller.Abilities public void UpdateLean(KinematicCharacterMotor motor, float deltaTime) { if (!_characterTransform) return; - - var isGrounded = motor.GroundingStatus.IsStableOnGround; + var currentPosition = motor.TransientPosition; var isStillNearWall = false; @@ -109,19 +108,17 @@ namespace Code.Gameplay.Character.Controller.Abilities if (_isLeaningOnWall) { - switch (isGrounded) + var isBelowContactHeight = currentPosition.y < _lastWallContactHeight; + + if (!isStillNearWall || isBelowContactHeight) { - case true when !isStillNearWall: - case false when !isStillNearWall: - _isLeaningOnWall = false; - break; - default: - { - var heightDelta = currentPosition.y - _lastWallContactHeight; - var targetLeanFactor = Mathf.Clamp01(heightDelta * _heightScale); - _leanFactor = Mathf.Lerp(_leanFactor, targetLeanFactor, 1f - Mathf.Exp(-_leanSharpness * deltaTime)); - break; - } + _isLeaningOnWall = false; + } + else + { + var heightDelta = currentPosition.y - _lastWallContactHeight; + var targetLeanFactor = Mathf.Clamp01(heightDelta * _heightScale); + _leanFactor = Mathf.Lerp(_leanFactor, targetLeanFactor, 1f - Mathf.Exp(-_leanSharpness * deltaTime)); } } diff --git a/Game/CourierOld/Assets/Resources/Scenes/MovementDev.unity b/Game/CourierOld/Assets/Resources/Scenes/MovementDev.unity index d427220..ae7cc12 100644 --- a/Game/CourierOld/Assets/Resources/Scenes/MovementDev.unity +++ b/Game/CourierOld/Assets/Resources/Scenes/MovementDev.unity @@ -366,7 +366,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &678700802 Transform: m_ObjectHideFlags: 0