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
+1 -1
View File
@@ -2310,7 +2310,7 @@ MonoBehaviour:
lives: 3 lives: 3
maxSpeed: 25 maxSpeed: 25
acceleration: 0.5 acceleration: 0.5
friction: 0.1 friction: 1
jumpHeight: 20 jumpHeight: 20
gravity: 5 gravity: 5
rotationSpeed: 20 rotationSpeed: 20
+1 -1
View File
@@ -3898,7 +3898,7 @@ MonoBehaviour:
lives: 3 lives: 3
maxSpeed: 25 maxSpeed: 25
acceleration: 0.5 acceleration: 0.5
friction: 0.1 friction: 1
jumpHeight: 20 jumpHeight: 20
gravity: 5 gravity: 5
rotationSpeed: 20 rotationSpeed: 20
+1 -1
View File
@@ -2510,7 +2510,7 @@ MonoBehaviour:
lives: 3 lives: 3
maxSpeed: 25 maxSpeed: 25
acceleration: 0.5 acceleration: 0.5
friction: 0.1 friction: 1
jumpHeight: 20 jumpHeight: 20
gravity: 5 gravity: 5
rotationSpeed: 20 rotationSpeed: 20
+1 -1
View File
@@ -2246,7 +2246,7 @@ MonoBehaviour:
lives: 3 lives: 3
maxSpeed: 25 maxSpeed: 25
acceleration: 0.5 acceleration: 0.5
friction: 0.1 friction: 1
jumpHeight: 20 jumpHeight: 20
gravity: 5 gravity: 5
rotationSpeed: 20 rotationSpeed: 20
+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)){ 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 //Remove or "lower" friction to add an 'ice' effect
velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, friction); velocity.x = Mathf.SmoothDamp(velocity.x, 0.0f, ref xVelocity, 0.1f);
velocity.z = Mathf.SmoothDamp(velocity.z, 0.0f, ref zVelocity, friction); velocity.z = Mathf.SmoothDamp(velocity.z, 0.0f, ref zVelocity, 0.1f);
maxSpeed = 25; 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)) if(characterController.velocity == new Vector3(0, 0, 0))
{ {
maxSpeed = maxSpeedStore; maxSpeed = maxSpeedStore;