Me too :
:
A good environment always helps though and positive. If you are around cynical people and older people tend to be really smug and "think they know everything" (some, not all). If your living environment feels really negative then that has an impact on mood and motivation, if the same deal is happening at work/uni/school/whatever then it will probably have the same demotivational effect.
Once i started learning guitar and got myself into a few interests then my purpose changed. I have other things to keep me motivated when everything else isn't working, you know why? Because that is within my control.
When you have little motivation and you are in a non-ideal environment then that mood will influence you, where as if you start to control the things you can control, interests, education, exercise, diet, applying yourself even when you feel in a lull then its the best feeling ever, because you know you are simply "Doing".
Now when it comes to friends, the best thing? Go places, concerts, festivals, markets, holidays. Try your best to escape that repetitive environment of always going to your bedroom or house every day where you simply may be sick of it and you feel flat from the same routine.
Your soul may be screaming out to break the same routine and environment, which is what can cause depression and feeling unmotivated. Because its as if you are waiting for things to come to you, which never happens.