From 4c04f3d802542792edc412be30cabc670ff022b4 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sun, 17 Nov 2019 20:17:16 -0500 Subject: [PATCH] Made character direction change more smooth and less binary --- Assets/Scripts/PlayerController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 327d259..6b66668 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -30,7 +30,8 @@ public class PlayerController : MonoBehaviour { float yStore = moveDirection.y; - moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal")); + //Need to switch to 'raw' when using keyboard + moveDirection = (transform.forward * Input.GetAxis("Vertical")) + (transform.right * Input.GetAxis("Horizontal")); if (extraJump == true) { @@ -74,7 +75,8 @@ public class PlayerController : MonoBehaviour characterController.Move(moveDirection * Time.deltaTime); //Move the player in different directions based on camera look direction - if(Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) + //Need to switch to 'raw' when using keyboard + if(Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) { transform.rotation = Quaternion.Euler(0f, pivot.rotation.eulerAngles.y, 0f); Quaternion newRotation = Quaternion.LookRotation(new Vector3(moveDirection.x, 0f, moveDirection.z));