private float CalculateJumpVerticalSpeed(float targetJumpHeight) { // From the jump height and gravity we deduce the upwards speed // for the character to reach at the apex. return Mathf.Sqrt(2f * targetJumpHeight * Gravity); }