From f6556a6c76d5a87274f4375a700b4fc69b0a7ac9 Mon Sep 17 00:00:00 2001 From: Gregory Campbell Date: Sun, 19 Jan 2020 21:51:29 -0500 Subject: [PATCH] Fixed bug where player would move when falling without being given any input --- Assets/Scripts/PlayerController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 65fd262..4e5783d 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -307,7 +307,8 @@ public class PlayerController : MonoBehaviour velocity.y = moveDirection.y; - if(moveDirection.y <= -5 && Mathf.Abs(velocity.x) <= 1.5f && Mathf.Abs(velocity.z) <= 1.5f) + if(moveDirection.y <= -5 && Mathf.Abs(velocity.x) <= 1.5f && Mathf.Abs(velocity.z) <= 1.5f + && (Input.GetAxis("Horizontal") != 0 && Input.GetAxis("Vertical") != 0)) { velocity.x = velocity.x * Mathf.Abs(moveDirection.y); velocity.z = velocity.z * Mathf.Abs(moveDirection.y);