Character faces direction but then input moves character relative to the position character is facing

This commit is contained in:
Gregory Campbell
2019-11-10 20:40:36 -05:00
parent d50f3f315e
commit b6ad41aa53
+3 -1
View File
@@ -31,7 +31,9 @@ public class PlayerController : MonoBehaviour
moveDirection = (transform.forward * Input.GetAxisRaw("Vertical")) + (transform.right * Input.GetAxisRaw("Horizontal"));
//Player rotation
transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
//transform.Rotate(0, Input.GetAxis("Horizontal") * Time.deltaTime * rotationSpeed, 0);
Vector3 newPosition = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
transform.LookAt(newPosition + transform.position);
if (extraJump == true)
{