Localization is necessary for applications such as warning systems, where the sensed data along with the location of occurrence is essential for decision making in Wireless Sensor Networks (WSNs). Equipping each sensor node with a global positioning system (GPS) unit is infeasible, as it increases both the power consumption and cost of the deployed network. A more practical approach is to employ a single or a few GPS-equipped mobile anchor nodes (MANs). These MANs localize the unknown sensor nodes by broadcasting their current locations periodically while moving in the area of interest. In a realistic environment, obstacles may be present in the deployment area that obstruct the radio connectivity between unknown sensors and the MANs. In this paper, we propose a mechanism to handle irregular obstacles in the path of various existing static trajectories. Also, we have considered an accurate and reliable channel model to provide a realistic evaluation of the proposed method. The results are compared on the basis of four different localization techniques, namely, accuracy priority trilateration (APT), time priority trilateration (TPT), weighted centroid localization (WCL) and weight-compensated weighted centroid localization (WCWCL). Experimental and simulation results show that the proposed method effectively handles regular and irregular obstacles in the deployed environment.