From 0a2e22e6374efa0626769893a785181233e18792 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sun, 6 Oct 2019 20:31:13 -0400 Subject: [PATCH] Added simple player rotation --- Assets/Scripts/PlayerController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 7aae3ff..c5771fa 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -14,6 +14,7 @@ public class PlayerController : MonoBehaviour public float speed = 20.0f; public float jumpSpeed = 15.0f; public float gravity = 5.0f; + public float rotationSpeed = 150.0f; private bool extraJump = true; private Vector3 moveDirection; @@ -29,6 +30,9 @@ public class PlayerController : MonoBehaviour float yStore = moveDirection.y; moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal")); + //Player rotation + transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0); + if (extraJump == true) { moveDirection = moveDirection.normalized * speed; //Remove this line to make running diagonal the fastest standard run