In many applications of wireless sensor networks (WSNs), node location is required to locate the monitored event once occurs. Mobility-Assisted Localization has emerged as an efficient technique for node localization. It works on optimizing a path planning of a location-aware mobile node, called mobile anchor (MA). The task of the MA is to traverse the area of interest (network) in a way that minimizes the localization error while maximizing the num- ber of successful localized nodes. For simplicity, many path planning models assume that the MA has a sufficient source of energy and time, and the network area is obstacle-free. However, in many real-life applications such assumptions are rare. When the network area includes many obstacles, which need to be avoided, and the MA itself has a limited movement distance that cannot be exceeded, a dynamic movement approach is needed. In this paper, we propose two novel dynamic movement techniques that offer obstacle-avoidance path planning for mobility-assisted localization in WSNs. The movement planning is designed in a real-time using two swarm intelligence based algorithms, namely Grey Wolf Optimizer (GWO) and Whale Optimization Algorithm (WOA). Both of our proposed models, Grey Wolf optimizer based Path Planning (GWPP) and Whale Optimization algorithm based Path Planning (WOPP), provide superior outcomes in comparison to other existing works in several metrics including both localization ratio and localization error rate.