From 97d5ba183bf61c3fb965f5768068c0199495a9e7 Mon Sep 17 00:00:00 2001 From: DerTyp187 Date: Wed, 29 Sep 2021 20:12:28 +0200 Subject: [PATCH] Update PlayerMovement.cs --- Assets/Scripts/Character/PlayerMovement.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Character/PlayerMovement.cs b/Assets/Scripts/Character/PlayerMovement.cs index ce91352..e11bc10 100644 --- a/Assets/Scripts/Character/PlayerMovement.cs +++ b/Assets/Scripts/Character/PlayerMovement.cs @@ -24,6 +24,7 @@ public class PlayerMovement : MonoBehaviour private Rigidbody rb; private bool isGrounded; private float modifiedSpeed; + private bool isJumpSprinting = false; float x; float z; @@ -51,6 +52,12 @@ public class PlayerMovement : MonoBehaviour { //Check every frame if the player stands on the ground isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask); + + if (isGrounded) + { + isJumpSprinting = false; + } + } private void MovementSpeed() { @@ -76,15 +83,7 @@ public class PlayerMovement : MonoBehaviour { isSneaking = false; } - } - - //Sprint jump - if (isSprinting && Input.GetButtonDown("Jump")) - { - Debug.Log("Jump Sprint"); - rb.AddRelativeForce(Vector3.forward * jumpSprintSpeedModifier); - } - + } x = Input.GetAxis("Horizontal"); z = Input.GetAxis("Vertical");