private void processMovement() { // Check if we're actually on ground so we can move if (cc.isGrounded) { // Get default inputs float strafe = Input.GetAxis("Horizontal"); float fwd = Input.GetAxis("Vertical"); // Create new movement vector movementDirection = new Vector3(strafe, 0.0f, fwd); // Check if player is running if (running == true) { movementDirection *= (Constants.movementSpeed * Constants.runningSpeedModifier); } else { movementDirection *= Constants.movementSpeed; } // Movement vector from local to world movementDirection = transform.TransformDirection(movementDirection); if (cc.velocity.magnitude > 0.2f && footstep == true) { PlayerSoundManager.playFootstepSound(); StartCoroutine(checkLastFootStep(Constants.footstepDelay)); } // Check if the player is jumping if (Input.GetButton("Jump")) { PlayerSoundManager.playFootstepSound(); movementDirection.y = Constants.jumpingSpeed; } } // Apply the movement movementDirection.y -= -Physics.gravity.y * Time.deltaTime; cc.Move(movementDirection * Time.deltaTime); }