/// <summary> /// Apply a lerped downward force to the character /// when the player releases the jump button /// </summary> private void LimitJump() { if (InputController.jumpReleased && !charState.IsAnyDoubleJumping() && rb.velocity.y > 0) { //print("Jump released"); // Old downward force: -rb.velocity.y/2 downwardForce = Mathf.Lerp(0, maxDownwardForce, downwardForceSpeed * Time.fixedDeltaTime); rb.AddForce(new Vector3(0, downwardForce, 0), ForceMode.Impulse); } // limit the zero out the x/z movement if idle jumping and there's no input // This is a fix the the PhysicMaterialHandler's handling of changing materials if (charState.IsIdleJumping() && charController.speed == 0) { rb.velocity = new Vector3(0, rb.velocity.y, 0); } }