Aiming at the actual targets coverage scene of targets and sensors in the three-dimensional physical world, in order to use the minimal sensors to cover all the targets, a new coverage-all targets algorithm based on Gravitational Search algorithm (GSA-CT) is proposed. Firstly, from the practical point of view, a 3D coverage-all targets model of WMSNs which based on the spatial position relationship of sensors and targets is established in three-dimensional space. Secondly, in order to avoid randomness of the current order method to determine the minimal number of sensors to cover all the targets, a new fitness calculation method has been proposed. Thirdly, in order to improve solution accuracy, GSA is used as the optimization method of coverage-all targets method. Experimental results show that compared with the other 7 coverage methods for the 9 actual coverage scenarios, the number of sensors required for GSA-CT proposed in this paper is the least, and the method is very stable.