From d51527b7f3e53541571d9fb378c8331f946e82b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C5=A1a=20Ceviel?= Date: Fri, 28 Nov 2025 10:47:28 +0300 Subject: [PATCH] =?UTF-8?q?=D1=8D=D1=82=D0=BE=20=D1=81=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D0=B3=D0=B3=D0=B5=D0=B4=D0=BE=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/Abilities/WallRunningMechanic.cs | 11 ++++++++--- .../Character/Controller/CustomCharacterController.cs | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallRunningMechanic.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallRunningMechanic.cs index fe12720..a14ddd1 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallRunningMechanic.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/Abilities/WallRunningMechanic.cs @@ -85,11 +85,15 @@ namespace Code.Gameplay.Character.Controller.Abilities _wallContactPoint = contactPoint; WallContactHeight = contactPoint.y; - _wallTangentUp = Vector3.ProjectOnPlane(_motor.CharacterUp, _wallNormal).normalized; + //_wallTangentUp = Vector3.ProjectOnPlane(_motor.CharacterUp, _wallNormal).normalized; if (_wallTangentUp.sqrMagnitude < 0.01f) _wallTangentUp = Vector3.up; _wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized; + _wallTangentUp = Vector3.Cross(_wallTangentRight, _wallNormal).normalized; + if (Vector3.Dot(_wallTangentUp, Vector3.up) < 0) + _wallTangentUp = -_wallTangentUp; + WallRunStartForward = _motor.CharacterForward; _motor.ForceUnground(); } @@ -123,7 +127,7 @@ namespace Code.Gameplay.Character.Controller.Abilities 1f - Mathf.Exp(-WallRunAcceleration * deltaTime) ); - currentVelocity += Physics.gravity * WallRunGravityScale * deltaTime; + currentVelocity += Physics.gravity * (WallRunGravityScale * deltaTime); float distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal); if (Mathf.Abs(distanceToWall) > 0.8f) @@ -170,9 +174,10 @@ namespace Code.Gameplay.Character.Controller.Abilities _wallNormal = hit.normal.normalized; _wallContactPoint = hit.point; - _wallTangentUp = Vector3.ProjectOnPlane(_motor.CharacterUp, _wallNormal).normalized; + /*_wallTangentUp = Vector3.ProjectOnPlane(_motor.CharacterUp, _wallNormal).normalized; if (_wallTangentUp.sqrMagnitude < 0.01f) _wallTangentUp = Vector3.up; _wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized; + */ return true; } diff --git a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs index 70ca2d1..6f44cf2 100644 --- a/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs +++ b/Game/CourierOld/Assets/Code/Gameplay/Character/Controller/CustomCharacterController.cs @@ -65,7 +65,7 @@ namespace Code.Gameplay.Character.Controller // ); _wallRunningMechanic = new WallRunningMechanic(); // Настройка параметров WallRunningMechanic (можно вынести в конфиг позже) - _wallRunningMechanic.MaxWallRunTime = 1.75f; + _wallRunningMechanic.MaxWallRunTime = 5f; _wallRunningMechanic.WallRunSpeed = 15.0f; _wallRunningMechanic.WallRunAcceleration = 25.0f; _wallRunningMechanic.WallRunGravityScale = 0.25f; @@ -142,7 +142,7 @@ namespace Code.Gameplay.Character.Controller public void UpdateRotation(ref Quaternion currentRotation, float deltaTime) { - if (_slideMechanic.IsSliding || _wallRunningMechanic.IsWallRunning) return; + if (_slideMechanic.IsSliding) return; switch (_currentCameraMode) {