The Shaykh (Al-Mufid), may Allah سبحانه وتعالى support him, said: "And if the sky is completely covered with clouds and a person cannot determine the qiblah by means of the sun or stars, then he should pray facing all four directions. And if he is unable to do so due to any reason that prevents him from praying four times, then he should pray facing whichever direction he chooses, and that is sufficient in a state of necessity."
Commentary #2