Сглаживание бега
This commit is contained in:
parent
267ebc6fe5
commit
305f83a924
@ -24,6 +24,9 @@ public class SwingingArmMotionScript : MonoBehaviour
|
||||
private float CurrentSpeed; // Текущая скорость
|
||||
[SerializeField] private float HandSpeed;
|
||||
|
||||
private float SmoothedSpeed;
|
||||
[SerializeField] private float SpeedSmoothingFactor;
|
||||
|
||||
// Stamina (выносливость)
|
||||
[SerializeField] private float MaxStamina; // Максимальная выносливость
|
||||
[SerializeField] private float Stamina; // Текущая выносливость
|
||||
@ -43,6 +46,7 @@ public class SwingingArmMotionScript : MonoBehaviour
|
||||
PositionPreviousFrameLeftHand = LeftHand.transform.position; // Set previous positions
|
||||
PositionPreviousFrameRightHand = RightHand.transform.position;
|
||||
CurrentSpeed = BaseSpeed; // Initialize to base speed
|
||||
SmoothedSpeed = BaseSpeed;
|
||||
|
||||
Stamina = MaxStamina; // Инициализация выносливости
|
||||
|
||||
@ -116,7 +120,10 @@ public class SwingingArmMotionScript : MonoBehaviour
|
||||
IsRecovering = true;
|
||||
IsPreRecovery = true;
|
||||
}
|
||||
_MoveProvider.moveSpeed = CurrentSpeed;
|
||||
|
||||
SmoothedSpeed = Mathf.Lerp(SmoothedSpeed, CurrentSpeed, SpeedSmoothingFactor);
|
||||
|
||||
_MoveProvider.moveSpeed = SmoothedSpeed;
|
||||
|
||||
// Set previous position of hands for next frame
|
||||
PositionPreviousFrameLeftHand = PositionCurrentFrameLeftHand;
|
Loading…
x
Reference in New Issue
Block a user