That's all true. About the libido typically being better with happiness (as well as overall health). [Want really good sex? Eat well, exercise, stop smoking, and don't drink too much! -- in other words, get healthy.]
But there's also the fact that people who want to be happy very much prefer to be around other people who also want to be happy and who are happy (or at least willing to give it a try). It's much easier to be happy while around happy people. Being happy around miserable people is for saints!