Допил наклонов полноценный

This commit is contained in:
MrTorex committed 2025-11-11 19:48:37 +03:00
1 parent 177464cc09
commit 874280741c
4 files changed
+28 -212

No files matched your search

@@ -42,37 +42,40 @@ namespace Code.Gameplay.Character.Controller.Abilities
_leanDirection = -_lastWallNormal;
_leanDirection = Vector3.ProjectOnPlane(_leanDirection, motor.CharacterUp).normalized;
//TODO: БЛЯТЬ ПОЛНАЯ ХУЙНЯ НАДО ПЕРЕПИСАТЬ С ИФ ЭЛС НУ Я ПОСЛЕ ПУЛА ПРИДУ И ДОДЕЛАЮ
_leanSign = 1;
// what the fuck
if (_leanDirection.x != 0)
{
if ((int)_leanDirection.x == -1 && motor.CharacterRight.x > 0.1f)
_leanSign = -1;
else if ((int)_leanDirection.x == -1 && Mathf.Abs(motor.CharacterRight.x) < 0.1f)
_leanDirection = new Vector3(0, 0, -1);
else if ((int)_leanDirection.x == 1 && motor.CharacterRight.x > 0.1f)
_leanSign = -1;
else if ((int)_leanDirection.x == 1 && Mathf.Abs(motor.CharacterRight.x) < 0.1f)
_leanDirection = new Vector3(0, 0, -1);
switch (_leanDirection.x)
{
case -1 when motor.CharacterRight.x > 0.1f:
case 1 when motor.CharacterRight.x > 0.1f:
_leanSign = -1;
break;
case -1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f:
case 1 when Mathf.Abs(motor.CharacterRight.x) < 0.1f:
_leanDirection = new Vector3(0, 0, -1);
break;
}
}
else if (_leanDirection.z != 0)
else
{
if ((int)_leanDirection.z == 1 && Mathf.Abs(motor.CharacterRight.z) < 0.1f)
_leanSign = -1;
else if ((int)_leanDirection.z == -1 && motor.CharacterRight.z < -0.1f)
_leanDirection = new Vector3(-1, 0, 0);
else if ((int)_leanDirection.z == -1 && motor.CharacterRight.z > 0.1f)
_leanDirection = new Vector3(1, 0, 0);
else if ((int)_leanDirection.z == 1 && motor.CharacterRight.z < -0.1f)
_leanDirection = new Vector3(1, 0, 0);
else if ((int)_leanDirection.z == 1 && motor.CharacterRight.z > 0.1f)
_leanDirection = new Vector3(-1, 0, 0);
switch (_leanDirection.z)
{
case 1 when Mathf.Abs(motor.CharacterRight.z) < 0.1f:
_leanSign = -1;
break;
case -1 when motor.CharacterRight.z < -0.1f:
case 1 when motor.CharacterRight.z > 0.1f:
_leanDirection = new Vector3(-1, 0, 0);
break;
case -1 when motor.CharacterRight.z > 0.1f:
case 1 when motor.CharacterRight.z < -0.1f:
_leanDirection = new Vector3(1, 0, 0);
break;
}
}
Debug.Log("LeanDirection: " + _leanDirection);
Debug.Log("CharacterRight: " + motor.CharacterRight);
Debug.Log(_leanSign);
}
// Обновление каждый кадр
@@ -104,8 +107,6 @@ namespace Code.Gameplay.Character.Controller.Abilities
return;
}
if (_leanDirection.sqrMagnitude < 0.01f) return;
var leanAngle = _leanSign * _leanFactor * _maxLeanAngle;