private void Turning() { float additionalAngularMultiplier = InputManager.Data.isBrake ? brakingAngularMultiplier : 1f; if (trainMovement != TrainMovement.Stopped && Mathf.Abs(Vector3.Magnitude(rb.velocity)) > minVelocityToRotate) { Vector3 torqueDirection = new Vector3(0, InputManager.Data.moveX != 0 ? Mathf.Sign(InputManager.Data.moveX) : 0, 0); if (trainMovement == TrainMovement.Reversing) { rb.angularVelocity = Vector3.Lerp(rb.angularVelocity, (torqueDirection * -1) * (torqueForce * additionalAngularMultiplier * (reverseAccelerationTime / maxReverseAccelerationTime)) * Time.fixedDeltaTime, angularSmoothingTime); } else { rb.angularVelocity = Vector3.Lerp(rb.angularVelocity, torqueDirection * (torqueForce * additionalAngularMultiplier * (currentAccelerationTime / maxAccelerationTime)) * Time.fixedDeltaTime, angularSmoothingTime); } TurningOnIce(); } else { rb.angularVelocity = Vector3.zero; } trainManager.SetWagonsRotation(rb.angularVelocity.y / maxAngularVelocityForRotation * 100.0f); }