это спермаггедон

This commit is contained in:
MrTorex committed 2025-11-28 10:47:28 +03:00
1 parent d14f9c2a9f
commit d51527b7f3
2 files changed
+10 -5

No files matched your search

@@ -85,11 +85,15 @@ namespace Code.Gameplay.Character.Controller.Abilities
_wallContactPoint = contactPoint; _wallContactPoint = contactPoint;
WallContactHeight = contactPoint.y; 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; if (_wallTangentUp.sqrMagnitude < 0.01f) _wallTangentUp = Vector3.up;
_wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized; _wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized;
_wallTangentUp = Vector3.Cross(_wallTangentRight, _wallNormal).normalized;
if (Vector3.Dot(_wallTangentUp, Vector3.up) < 0)
_wallTangentUp = -_wallTangentUp;
WallRunStartForward = _motor.CharacterForward; WallRunStartForward = _motor.CharacterForward;
_motor.ForceUnground(); _motor.ForceUnground();
} }
@@ -123,7 +127,7 @@ namespace Code.Gameplay.Character.Controller.Abilities
1f - Mathf.Exp(-WallRunAcceleration * deltaTime) 1f - Mathf.Exp(-WallRunAcceleration * deltaTime)
); );
currentVelocity += Physics.gravity * WallRunGravityScale * deltaTime; currentVelocity += Physics.gravity * (WallRunGravityScale * deltaTime);
float distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal); float distanceToWall = Vector3.Dot(_motor.TransientPosition - _wallContactPoint, _wallNormal);
if (Mathf.Abs(distanceToWall) > 0.8f) if (Mathf.Abs(distanceToWall) > 0.8f)
@@ -170,9 +174,10 @@ namespace Code.Gameplay.Character.Controller.Abilities
_wallNormal = hit.normal.normalized; _wallNormal = hit.normal.normalized;
_wallContactPoint = hit.point; _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; if (_wallTangentUp.sqrMagnitude < 0.01f) _wallTangentUp = Vector3.up;
_wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized; _wallTangentRight = Vector3.Cross(_wallNormal, _wallTangentUp).normalized;
*/
return true; return true;
} }
@@ -65,7 +65,7 @@ namespace Code.Gameplay.Character.Controller
// ); // );
_wallRunningMechanic = new WallRunningMechanic(); _wallRunningMechanic = new WallRunningMechanic();
// Настройка параметров WallRunningMechanic (можно вынести в конфиг позже) // Настройка параметров WallRunningMechanic (можно вынести в конфиг позже)
_wallRunningMechanic.MaxWallRunTime = 1.75f; _wallRunningMechanic.MaxWallRunTime = 5f;
_wallRunningMechanic.WallRunSpeed = 15.0f; _wallRunningMechanic.WallRunSpeed = 15.0f;
_wallRunningMechanic.WallRunAcceleration = 25.0f; _wallRunningMechanic.WallRunAcceleration = 25.0f;
_wallRunningMechanic.WallRunGravityScale = 0.25f; _wallRunningMechanic.WallRunGravityScale = 0.25f;
@@ -142,7 +142,7 @@ namespace Code.Gameplay.Character.Controller
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime) public void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
{ {
if (_slideMechanic.IsSliding || _wallRunningMechanic.IsWallRunning) return; if (_slideMechanic.IsSliding) return;
switch (_currentCameraMode) switch (_currentCameraMode)
{ {