void Update() { if (!pmMenuIsOpen) { //check if player is on the ground isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask); if (isGrounded && velocity.y < 0) { velocity.y = -2f; } float x = Input.GetAxis("Horizontal"); float z = Input.GetAxis("Vertical"); //Running if (Input.GetKey(KeyCode.LeftShift) && isGrounded) { runMultiplyer = run; _levelController.SprintFOV(true); //Debug.Log("Gotta go fast! Run Multiplyer == " + runMultiplyer); } else if (!Input.GetKey(KeyCode.LeftShift)) { runMultiplyer = 1f; _levelController.SprintFOV(false); } //move character with a and d Vector3 move = ((transform.right * x) + (transform.forward * z)); //move with respect to speed and time controller.Move(move * (speed * runMultiplyer) * Time.deltaTime); //jump if (Input.GetButtonDown("Jump") && isGrounded) { velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity); _playerSounds.PlayOneShot(jumpSound, 1f); } //set velocity to gravity velocity.y += gravity * Time.deltaTime; //move with velocity with time squared controller.Move(velocity * Time.deltaTime); } }