Fixed bug where player would move when falling without being given any input

This commit is contained in:
Gregory Campbell
2020-01-19 21:51:29 -05:00
parent d65832e7f1
commit f6556a6c76
+2 -1
View File
@@ -307,7 +307,8 @@ public class PlayerController : MonoBehaviour
velocity.y = moveDirection.y; 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.x = velocity.x * Mathf.Abs(moveDirection.y);
velocity.z = velocity.z * Mathf.Abs(moveDirection.y); velocity.z = velocity.z * Mathf.Abs(moveDirection.y);