Made turning for the player much tighter and less slidey/icy

This commit is contained in:
Gregory Campbell
2020-02-07 22:30:42 -05:00
parent 9827e5be20
commit df08ad71b0
5 changed files with 10 additions and 6 deletions
+6 -2
View File
@@ -299,12 +299,16 @@ public class PlayerController : MonoBehaviour
if((Input.GetAxis("Horizontal") == 0 && Input.GetAxis("Vertical") == 0) || (Input.GetButton("Stop") || Input.GetAxis("Stop") == 1.0f)){
//Remove or "lower" friction to add an 'ice' effect
velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, friction);
velocity.z = Mathf.SmoothDamp(velocity.z, 0.0f, ref zVelocity, friction);
velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, 0.1f);
velocity.z = Mathf.SmoothDamp(velocity.z, 0.0f, ref zVelocity, 0.1f);
maxSpeed = 25;
}
//Remove or "lower" friction to add an 'ice' effect
velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, friction);
velocity.z = Mathf.SmoothDamp(velocity.z, 0.0f, ref zVelocity, friction);
if(characterController.velocity == new Vector3(0, 0, 0))
{
maxSpeed = maxSpeedStore;