Maintaining erection

Me and my girlfriend were in the middle of having sex and I completely lost my erection. After this she refused to cum without me and I tried multiple times to get my erection by with no luck. This has happened a couple of times before. It's pretty hot where we are right now, could that be a contributing factor?